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.

up vote 20 down vote accepted

Well, here you go with an AppleScript for that.

First, create the AppleScript:

  1. Open Automator
  2. Create a Service
  3. Set the input to no input
  4. Drag and Drop the Run AppleScript workflow element onto the grey space.
  5. Paste the code from below into the AppleScript
  6. Save the workflow as Create new file
    If you have iCloud Drive activated, make sure you are saving the file under Library/Services/ in your Home Folder.

  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 & "\""

To add it as a shortcut:

  • Go to Settings -> Keyboard -> Shortcuts -> Services
  • Scroll down until you find the Service Create new file
  • Assign a shortcut to it by clicking on the right side none, which turns into a Add Shortcut.
    Click the Button and type the shortcut you wish to use.
    I use ⌘ Command+⌥ Option+N
  • 2
    I don't understand how to set at shortcut to this specific script through the services tab – Harry May 5 '14 at 12:25
  • I added a more detailed way on how to add this script as a shortcut. – rwenz3l 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". – rwenz3l May 5 '14 at 12:32
  • See also superuser.com/questions/106943/… – mems Dec 2 '14 at 11:05
  • 4
    Why don't they have something like that by default? What is the matter with them? – G.Rassovsky May 7 '15 at 9:58

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 Finder.app;
  • 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.

  • 1
    Excellent script, thank you. The only thing I'd add to this write-up to make it more complete is info instructing newer Automator users that the workflow script they create should be saved in ~/Library/Services. (My default was in iCloud Drive\Automator and it took me a little research to figure out where to save it so it would appear in under Services in Keyboard Shortcuts.) – Colin Johnston Aug 1 '16 at 21:35

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 Finder.app 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.

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.

  • 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 '16 at 17:50

open terminal and type

touch filename


> filename
  • you lost me here? what does that do? – Buscar웃 May 5 '14 at 14:40
  • 3
    Could you expand on how you would add a keyboard shortcut to this command? (@Buscar See touch) – grg May 5 '14 at 14:40
  • 1
    well if you have PathFinder - that is really a great option ;D – rwenz3l 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. – Harry 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.

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: http://mac.softpedia.com/progDownload/NewTextFileHere-Download-70374.html

An alternative, if you already have BetterTouchTools (it used to be a free app, now it has a pay-what-you-want model with a 30 day trial period), you can find the action on "Utility Actions > Create New File in Current Folder" which does exactly this, with a pop-up to let you pick the name. Assign the shortcut you want (I picked Option+Shift+N) and you're good to go.

In case you are using MacVim there is an option under Finder -> Services to create a new vim buffer:

enter image description here

I have mapped this to the short cut ShiftcmdM in System Preferences -> Keyboard -> Shortcuts:

enter image description here

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

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