65

In Finder > Select a folder > Right click, we get a popup with an option to create a new folder:

enter image description here

Is there a way to add menu item New Textfile for adding a new text file?

  • 1
  • 19
    one of the dumbest things about mac, its 2017!! and still no feature out the box – SuperUberDuper May 4 '17 at 8:09
  • OMG... I thought I'm retarded. Another favourite one - I download a new app - move to Applications folder and then CMD + space - brand new machine, still not indexed, I need to navigate manually... Is it just me? – Mars Robertson Aug 4 '17 at 11:39
  • The so called best machines still doesn't have this basic feature. I have to use touch in cmd everytime and open. – Krishnadas PC Jun 12 '18 at 9:22
  • I wrote tutorial how to get this option into context menu with automator filipmolcik.com/new-file-mac-os – Filip Molcik Feb 7 at 12:45
13

You could assign a shortcut to a script like this:

tell application "System Events" to tell process "Finder"
    value of attribute "AXFocusedWindow" is scroll area 1
end tell
tell application "Finder"
    if result is true or number of windows is 0 then
        set t to desktop
    else
        set t to target of Finder window 1
    end if
    set f to make new file at t
    if t is desktop then
        set selection to f
    else
        select f
    end if
end tell

There is a bug in 10.7 and 10.8 that affects many other scripts and Automator services like this. Finder ignores new windows when getting the insertion location and selection properties. If you open a new Finder window, select some items in it, and run tell app "Finder" to selection in AppleScript Editor, the result is the items selected in some window behind the frontmost window (or an empty list). One workaround is to move focus to another application and back, but it results in a visual glitch.

So neither of these ways of checking if the desktop is selected work reliably:

tell application "Finder"
    insertion location as alias is desktop as alias
    container of item 1 of (get selection) as alias is desktop as alias
end tell

You could also wrap the script as an Automator service, but there is another bug where the shortcuts for Automator services don't always work until you hover over the services menu from the menu bar. If the input type was set to no input, the service wouldn't show up in context menus. If it was set to folders or files, you'd have to always secondary-click some folder or file.

Related questions:

I didn't vote to close this question, because many of the solutions in the other questions are affected by either of the two bugs mentioned above. We'll likely get even more questions like this, which could then be closed as duplicates of this question.

  • 10
    this is so dumb its not default – SuperUberDuper Feb 11 '16 at 16:38
21

I am using XtraFinder plugin for Mac OS's built in Finder. It has most of the features including create new file in finder options.

You'll love it like I do

;)

  • Nice app! Didn't know it, it has a tons of extra features! Thanks for the suggestion! – Zequez Feb 26 '15 at 3:35
  • Ace, add your own file templates – ptim Sep 8 '15 at 14:53
  • Good idea, but he only problem with XtraFinder is the System Integrity Protection after El Captain. You need to partial disable the SIP. Please read this url trankynam.com/xtrafinder/sip.html – Pedro Luz Feb 8 '16 at 10:10
  • 1
    A better idea is to use BetterTouchTool, which doesn't require SIP to be disabled—it uses the Accessibility API. AND it has a "create new file in current folder" option as one of the countless actions you can trigger. – Wildcard Sep 26 '16 at 10:19
8

There is a new APP in the store: https://itunes.apple.com/us/app/new-file-menu/id1064959555?ls=1&mt=12

New File Menu allows you to create new files quickly via the Finder context menu.

  • If you upgraded to macOS Sierra, you may need to reinstall New File Menu.New File Menu is simply the coolest way to create a new file on the Mac OS X platform, you can right click in any Finder window to create a new file! You can even right click on the desktop to create your files!

Important: New File Menu is implemented as a Finder extension, you need to enable "New File Menu Extension" in "System Preferences » Extensions" to make the context menu appear.

  • 2
    Costs $2, you're paying $2 for a new file button. You're not in Kansas anymore – Ray Foss Jul 19 '17 at 21:28
  • The app is amazing! I felt such a sense of relief just seeing the screenshots. It works like a charm! Fixed one of my last frustrations with macOS. – Curyous Jun 20 '18 at 22:05
  • $2 for something that should already be there. Gaaaaaaaaa. I'm upvoting the answer...but complaining bitterly about apple/itunes. – granadaCoder Mar 14 at 19:01
  • Great app. It's worth the $2 for all the fancy customization, rather than using stupid automator scripts – Tallboy May 18 at 16:04
5

Edit: I couldn't get the above working as a Service but then I found a dialog hiding behind everything else where Finder was asking for permission to use the accessibility features. Once I'd enabled that the answer from Lauri Ranta worked. But the one below works well and doesn't need extra permissions.

I've tried several ways, the cleanest I've found is the Automator script provided here:

http://oscargodson.com/posts/new-file-in-right-click-context-menu-for-mac.html

And available from Github here:

https://github.com/OscarGodson/New-File

  • This works. The instructions say to open it and hit cmd + s but that did nothing for me. I'm on Mavericks and when opening it, I was prompted to either install or open. I had choose to install it in order for it to work. – Justin Mar 7 '14 at 21:31
5

There is a little known feature of the Finder called Stationary Pad. Imagine having a pad of paper that you could "tear off" a new sheet from on your desktop. Each page in the pad could have a custom layout and pre-existing content etc, allow you to (for example) fill in a "while you were out, X called" memo.

I'm not as a Mac at present to get screenshots etc, but if you open up a text document, and then enter the details you want to be used as your template (bearing in mind a totally blank sheet is a perfectly valid template), then save it somewhere, right click and Get Info, then click the Stationary Pad tick box, then that file will subsequently behave differently from a normal file. Double clicking to open the file will actually open a copy of the file, without any filename set, as if it were a totally new document, allowing you to fill it in and save it with a name/location of your choosing. The great thing about this is that without unticking the stationary pad option, you cannot accidentally overwrite or otherwise modify the original template.

There is more info if you google, this is a brief summary with helpful commens that isn't too old.

This isn't quite right clicking on the desktop and clicking "New File", but if your template icon is on the desktop it's arguably faster (depending on if you are faster at locating an icon and double clicking, or using any white space, right clicking then choosing from a context sensitive menu...)

Alternatively, you could use a combination of one of the scripted methods shown in other answers to get them to simply open a Stationary pad file, and you can recreate the "create blank" feature nicely from any App, even ones that don't support Applescript, and the "blank" document doesn't even have to be blank, but can be a template.

  • At first glance, this doesn't work on Mavricks, does it? – Camden S. Jan 22 '14 at 19:05
  • Trying this on Mavericks, it doesn't work quite as advertised in this answer. It copies the file and opens that new copy right away, not bringing up an option to choose the file name before you start editing it. (and indeed, opening it which you may not want if you just want to create and name the new file.) – user46942 Mar 3 '14 at 22:51
  • As per "Double clicking to open the file will actually open a copy of the file, without any filename set, as if it were a totally new document, allowing you to fill it in and save it with a name/location of your choosing." perhaps my wording isn't great, I'm not suggesting you get the chance to select the filename at this point, by fill in I mean't "write stuff in your document or fill in your template etc". Hope this clear things up. – stuffe Mar 4 '14 at 15:22
  • This is interesting to know! However for me, I need to be able to create a new text file anywhere, rarely on the Desktop :) – RedYeti Mar 8 '14 at 10:02
2

If you use Alfred, you can try this workflow. http://www.packal.org/workflow/create-new-file-finder-file-type-templates

Then you can type "new" in Alfred to create a new file in the current folder.

1

High Sierra: Go to System Prefs/Keyboard/Shortcuts, choose SERVICES and check "Open Selection in a TextEdit window". It will show up in your Services menu now. You can add a hotkey there too.

0

If you download and install BetterTouchTool you can set up this action easily; it's one of the built-in available triggers.

Better yet, you can set it up for any keyboard shortcut or trackpad gesture you like. (Including a lot of trackpad gestures you didn't know existed.)

(I'm not affiliated with BTT in any way, but I do feel that a lot more Mac users should be using it. It is the first application I install on any new Mac and I've been using it for over five years.)

  • 1
    Interesting. Can you give more details how this is done? – n1000 Mar 21 '17 at 8:22
  • @n1000, I don't have time currently. It's extremely simple; I guess I could add some screenshots, though. – Wildcard Mar 21 '17 at 20:22
  • It's "extremely simple" yet you don't have to time to add this one detail which actually addresses the question. – cornflakes24 Nov 3 '17 at 19:41
0

This also works pretty well if you're willing to spend a bit of money: https://langui.net/new-file-menu/

  • Welcome to Ask Different! We're trying to find the best answers and those answers will provide info as to why they're the best. Explain why you think the software you recommended is better than others out there. Providing links is good but answers need to be self-contained and not just be a link. See How to Answer on how to provide a quality answer. - From Review – fsb Jul 11 '18 at 20:07

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .