Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I wanted to know if there is way to set keyboard shortcuts to make new files in Finder. For example, by default, you can create a new folder using CMD+Shift+N. Is there a keyboard shortcut to create a new text file? I'm a programmer so this would be extremely useful

I would also be interested in creating other file type using keyboard shortcuts.

I have attempted to use automator but I'm finding it quite confusing and I'm not sure how I would connect a keyboard shortcut to it.

share|improve this question
up vote 14 down vote accepted

Well, here you go with an AppleScript for that. To Use it, Open Automator, create a Service, set the input to "no input", Drag and Drop the "Execute AppleScript" Workflow Element onto the grey space, save the workflow;

Go to Settings -> Keyboard -> Shortcuts -> Services, Assign a Shortcut to it.

The Shortcut may not work, if it is assigned to an Apple-Intern Shortcut already. So be creative on choosing a new one.

  tell application "Finder" to set the this_folder ¬
   to (folder of the front window) as alias
on error -- no open folder windows
  set the this_folder to path to desktop folder as alias
end try

set thefilename to text returned of (display dialog ¬
 "Create file named:" default answer "filename.txt")
set thefullpath to POSIX path of this_folder & thefilename
do shell script "touch \"" & thefullpath & "\""
share|improve this answer
I don't understand how to set at shortcut to this specific script through the services tab – himion0 May 5 '14 at 12:25
I added a more detailed way on how to add this script as a shortcut. – YoshiBotX May 5 '14 at 12:27
Now it should work with empty folders also. At least it works for me. You can write your template file inside the script "filename.txt". – YoshiBotX May 5 '14 at 12:32
See also… – mems Dec 2 '14 at 11:05
Why don't they have something like that by default? What is the matter with them? – G.Rassovsky May 7 '15 at 9:58

You can create an Automator Service yourself — it is rather simple to do. Then you can assign a keyboard shortcut to it so that you don't need to activate the service through the services menu (which you can do anyway).

Open Automator and select Service as the type of new document.

Set the service to receive no input in and add the New TextEdit Document action to the workflow.


Save the service, then open System Preferences → Keyboard → Shortcuts → Services where you will find the service listed under General with the name that you gave for the service when you saved it.


Add a keyboard shortcut to the service by selecting the service then clicking 'add shortcut'.

Here you might have some problems if the shortcut is used already. So get creative to make one that works for you.

share|improve this answer

You could also assign a shortcut to a script like this:

tell application "Finder"
    set selection to make new file at (get insertion location)
end tell

The insertion location is either the target of the frontmost Finder window or the desktop.

share|improve this answer
Your code is so simple and useful! I use the Automator to create a Application, which there is only one action: Run AppleScript with your code. Then I put this Application into the Finder Titlebar. That's OK. when I need, just click, and a new file will be create in current folder. – fantouch Jan 15 at 17:50

I've created an AppleScript very similar to the @YoshiBotX's one, but with some improvements.

The idea is to create an Automator workflow and assigning a shortcut to it using the following steps:

  • Open Automator and create a Service;
  • Set the input to no input, and the application to;
  • Drag and Drop the Run AppleScript workflow element onto the grey space;
  • Put the contents of this AppleScript in the textbox;
  • Save the workflow with a reasonable name (like New File);
  • Go to Settings -> Keyboard -> Shortcuts -> Services and assign a shortcut to it.

Now, let's show the AppleScript:

set file_name to "untitled"
set file_ext to ".txt"
set is_desktop to false

-- get folder path and if we are in desktop (no folder opened)
    tell application "Finder"
        set this_folder to (folder of the front Finder window) as alias
    end tell
on error
    -- no open folder windows
    set this_folder to path to desktop folder as alias
    set is_desktop to true
end try

-- get the new file name (do not override an already existing file)
tell application "System Events"
    set file_list to get the name of every disk item of this_folder
end tell
set new_file to file_name & file_ext
set x to 1
    if new_file is in file_list then
        set new_file to file_name & " " & x & file_ext
        set x to x + 1
        exit repeat
    end if
end repeat

-- create and select the new file
tell application "Finder"

    set the_file to make new file at folder this_folder with properties {name:new_file}
    if is_desktop is false then
        reveal the_file
        select window of desktop
        set selection to the_file
        delay 0.1
    end if
end tell

-- press enter (rename)
tell application "System Events"
    tell process "Finder"
        keystroke return
    end tell
end tell

For convenience, I'm putting this AppleScript in this GitHub Gist.

share|improve this answer

open terminal and type

touch filename


> filename
share|improve this answer
you lost me here? what does that do? – Buscar웃 May 5 '14 at 14:40
Could you expand on how you would add a keyboard shortcut to this command? (@Buscar See touch) – grgarside May 5 '14 at 14:40
well if you have PathFinder - that is really a great option ;D – YoshiBotX May 5 '14 at 22:10
This works pretty nicely with cmd2shell. No shortcut, but just click the cmd2shell button in finder and type the touch command. – eflat Mar 6 '15 at 20:18
I was looking for something more compatible with the Finder in OSX. – himion0 May 10 '15 at 14:11

This is a repost of a post that I made last year. I have had good experience with the following.

There are two useful utilities that you can download and install that will enable you to create a new text file (or RTF file) in a currently-open folder that you are viewing using the Finder.

The utilities are called NewTextFileHere and NewRTFHere and can be downloaded from

Icons for either of these apps can then be included on all of your Finder windows.

share|improve this answer

Just what I'd been looking for, Richard Fuhr. Thanks for this.

One note: that URL's link for the NewTextFileHere seems to load to an empty page. But I did a search and found the app here:

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.