- This works to create a custom keyboard shortcut in macOS and Mac OS X, the technique is compatible and behaves the same in basically every version of Mac OS system software dating back well over a decade.
- Mac Snow Leopard makes it easy for you to create and edit your text files, such as word-processing files. Text files let you create and format documents that include text and photos and even embed music and video files for Web pages you build.
OK, so if I'm browsing directories in OS X Finder, what's the easiest way to create a new text file?
Right now I have to either open TextEdit, click around until I get to the same directory I'm in, or I have to open a terminal window, cd to the directory, and touch blahblah.txt
. I'm spoiled by the right-click menu in Windows.
So, knowing that this particular topic is so hot, I thought it would be interesting to show you how to create a text file on Mac OS, this time without Quicksilver. For those of you who don’t kow the original post, here is a more detailed description of using Quicksilver for creating text files, prepending or appending text to them.
17 Answers
Personally I use the Open in textmate button that I have added to the toolbar. Steps to download and install the extension are in the link.
Or you can use this apple script
Open script editor, save as an applescript application to a known location I use /Applications/Scripts and then drag it to the toolbar.
This will create a text file untitled in the current folder.
Bruce McLeodBruce McLeodAdding the Touch Here App to Finder may help, but I've never used it.
Add this tiny AppleScript app to your finder toolbar and whenever you click on it it will prompt you for a file name and will create an empty file in the current folder.
ArjanArjanNufile does exactly what you want - right click contextual menu for file creation in finder. You can create most any type of file, define template files etc.
The image is for Tiger, in Leopard the 'New file' is a sub-menu of 'More'
kenorbNOTE: After the introduction of SIP, this app does not work unless you disable it. Read more on how to do it, but it is ill-advised.
Try XtraFinder.
This app is just great, solved all my basic needs after switching from a windows platform like adding 'New File' in context menu and finder toolbar, etc. Some of the features as listed on their website are -
XtraFinder add Tabs and features to Mac Finder.
• Tabs & Dual Panel.
• Arrange folders on top.
• Cut & Paste.
• Global hotkeys.
• 'Copy Path', 'Show Hidden Items', 'Hide Desktop', 'Refresh', 'New File', 'Copy to', 'Move to', 'New Terminal Here', 'Make Symbolic Link', 'Contents', 'Attributes', … .
• Legacy label for OSX 10.9 & 10.10. Light text on dark background. Transparent window.
• Colorful icons in Sidebar.
• Size of selected items in Status Bar.
• Automatically adjust width of columns.
• Press Enter or Return to open selection.
• Display folder item count in List view.
• Middle-click to open folder in new window or new tab.
• Much more.
I use this app with OS X 10.9.5 and did not encounter any issues with it. It has native os x icon style which looks good on retina screens also. Here is a screenshot of my finder toolbar -
Ps. this app is also free!
With Quicksilver you could just:
- Invoke QS 'command x'
- hit the '.' key for text entry and add in your text
- tab over and 'cr' for create file
- tab over and 'tex' for text edit
That's how I do it. You could use the save dialog box to choose your directory or you can just drag the file directly from quicksilver into your directory.
GaffAnother option is to assign a shortcut to a script like this:
If you use the command line for other purposes as well, you might like DTerm. It provides a pop-up command line whose current directory corresponds to the frontmost window (works with any window which has an icon in the title bar), so you can just press the shortcut and type touch blahblah.txt
without needing to change directories.
There are Windows-style contextual menu file creators which are a more direct answer for your problem. But if you are a frequent command line user — if you're the sort who has a project open in an editor and a corresponding terminal window — then DTerm is well worth trying as a broader tool.
Kevin ReidKevin ReidThe AppleScript-based application NewTextFileHere does that, too. Download page is here. It can be dragged to the Finder toolbar, and it can open the file automatically once it's created.
If you open the application package …
… and go to Contents/Resources/Scripts/, you can open main.scpt and edit it. For example, I was annoyed that it only created text files. Change it to the following to just have it create any file you want:
slhckslhckI usually start a text file in my editor (TextMate), save the file when the 'Save' dialog appears switch to the Finder and drag the folder (Click and hold the folder itself or the folder icon in the title of the window) and drag it to the open 'Save' panel. The Save panel will then switch to saving in that directory.
If you have Default Folder it's even easier. Just click on the folder's window without switching to the finder and you are then saving in that folder.
If you also use an application launcher, it's no big deal.
Personally I use AlfredApp and I can do like this
the '>' will tell AlfredApp to execute the following command.
slhckYou could replace Finder with Path Finder.
Path Finder offers the tools you need to access and manage your files quickly, accurately, and completely on OS X. A world-class operating system deserves a world-class file manager. Dive into a familiar interface packed with uncommonly powerful features and make your file system sing with Path Finder 6.
Tamara WijsmanWith a button on the Finder toolbar:
Steps to create the button:
Create a new applescript using the AppleScript Editor provided in Applications/Utilities
Paste
tell application 'Finder' to make new file at (the target of the front window) as alias
and export as an application.Drag to finder (In Mavericks to create a shortcut you must hold
cmd
+alt
while dragging)
Instructions to create the icons are here.
Create Cool Text
If you want to just create a file you can directly use this command in the terminal, touch Filename.extension
If you want to create a file with context inside, you use this command.
Notice the trick here, is you are actually using the echo to print/post whatever is in-front of the echo command and right after you just say oh why don't you put this echo in this Filename.extension instead of echo it to me on the screen.
This has also been discussed on Apple SE. I currently use the drag and drop solution. This has the benefit whereby you can have a large number of template files. So addition to have a blank textfile, you could also have other common blank files that you might use (e.g., Excel, Word, LaTeX templates, etc.)
The answer is here, which I quote below:
A simple drag-and-drop solution works for me.
Create a folder called 'New documents'. In this folder, save a blank document of each type you want. In my case, I have a blank TextEdit document (.rtf) and a blank TextMate document (.txt).
Lock this folder (select, cmd-I, click 'Locked').
Put the folder in the Dock.
Now, whenever you want a new document, you simply drag it from this Dock folder to wherever you want it. Because the 'New documents' folder is locked, the original won't be deleted; rather, the Mac will make a copy for you.
You can create a new context menu entry.
Here is a guide: http://www.hongkiat.com/blog/customize-mac-right-click-menu/
Here is the summary:
- Create a service with Automator, that takes Files and Folders as input, and applies to Finder application. The trick here is to make the automator that creates a blank file.
- Save the service. It will be saved in ~/Library/Services. But the useful thing to know is that it will also appear in the context menu of the files and folders, under the submenu 'Services'.
- Optionally, create a keyboard shortcut. Go to System preferences -> Keyboard -> Shortcuts -> Services and find your automator service there, assign a shortcut key that you like.
How To Create Text File From Excel Macro
This script will add an item to your context menu (tested on OSX Mavericks) and is VERY easy to install:
To install on Mavericks:
Create Text Free
- download the script
- Open
New File.workflow
- I was prompted to either install or open -- choose to install.
That's it.
You'll see the 'New File' option when you right click the parent folder or any file. Sometimes it is under 'Services' menu item.
Neu does exactly that http://www.elegantchaos.com/neu/ – it adds 'Create document' item to 'Right click -> Services'