All articles

How to Create a New Text File in Any Folder on a Mac

· 5 min read

On Windows, you right-click inside a folder, choose New › Text Document and type a name. On a Mac, the same right-click in a Finder window offers New Folder, and nothing for a file.

The Finder can't create an empty file. Its File menu makes windows, tabs, folders and smart folders, never documents: on a Mac, a new file starts in an app, and you choose where to save it afterwards. macOS gives you three ways around this: save a blank document from TextEdit, type touch in Terminal, or build a Quick Action with Shortcuts that puts the command in the Finder's right-click menu. Or use a file manager that has the command: in Folia Files, you right-click an empty spot in any folder and choose New File, then a type of file or one of your own templates.

Folia Files: a right-click on an empty spot of the Documents folder opens a menu with New Folder and New File

Three ways to do it with macOS alone

1. TextEdit, then Save

TextEdit comes with every Mac and can save plain text.

  1. Open TextEdit and choose File › New (⌘N).
  2. Choose Format › Make Plain Text (⇧⌘T). Without this step, TextEdit saves a rich text file (.rtf), not a .txt.
  3. Choose File › Save (⌘S), type the name and pick the folder. You can drag the folder from a Finder window onto the Save dialog to take the dialog straight to it.
  4. Leave If no extension is provided, use “.txt” checked, or type another extension yourself, such as notes.md.

To always start in plain text, open TextEdit's settings (⌘,) and, in the New Document tab, set Format to Plain text.

It works anywhere, but it takes four steps for an empty file, and the Save dialog doesn't open in the folder you were looking at.

2. touch in Terminal

  1. Open Terminal, in Applications › Utilities.
  2. Type cd followed by a space, drag the folder from the Finder into the Terminal window (its path is typed for you), and press ↩.
  3. Type touch notes.txt and press ↩.

The empty file appears in the folder. touch takes several names at once (touch todo.md ideas.txt), and open -e notes.txt opens the file in TextEdit. If a file with that name already exists, touch leaves its content alone and only updates its dates.

3. A Quick Action made with Shortcuts

To get a command in the Finder's right-click menu, build it once in the Shortcuts app:

  1. Create a new shortcut and name it, for example, “New Text File”.
  2. In its details, turn on Use as Quick Action with Finder, and set it to receive Folders.
  3. Add the Run Shell Script action, set Pass Input to as arguments, and type touch "$1/Untitled.txt".
  4. Shortcuts runs shell scripts only if you allow it: in its settings (⌘,), Advanced tab, turn on Allow Running Scripts.

Now right-click a folder in the Finder and choose Quick Actions › New Text File: an empty “Untitled.txt” appears inside it. The name is always the same, and there is no choice of file type: you need one Quick Action per kind of file. Automator, still included in macOS, can build the same Quick Action with its own Run Shell Script action.

A last trick needs no setup at all: keep an empty file somewhere, select it in the Finder and press ⌘D to duplicate it, then rename and move the copy.

New File in Folia Files

Folia Files puts the command where Windows users look for it. Right-click an empty spot in a folder, with nothing selected, and choose New File. The same submenu is in the menu bar, under File › New File, for the active pane.

The submenu lists ready-made types: Text Document (.txt), Markdown (.md), HTML Page (.html), JSON (.json), Shell Script (.sh), Python Script (.py) and Swift (.swift). Choose one and:

  • the file is created in the folder the pane shows, named “Untitled.txt” (or “Untitled 2.txt” if that name is taken: an existing file is never replaced);
  • it is selected, with its name ready to edit and the extension left out of the selection: type the name and press ↩;
  • a shell or Python script starts with its #! line and is already executable.

New Folder sits right above it, with the Finder's shortcut, ⇧⌘N.

Your own templates

At the bottom of the submenu, My Templates… opens the templates folder in the pane. Every file you copy there appears in New File, with its name and icon: an invoice laid out in Pages, a budget spreadsheet, a Markdown note with your usual headings, a README for new projects. Choosing one copies it into the current folder under its own name, ready to be renamed; the template itself stays as it is. A folder works too: a project skeleton with its subfolders is copied in one go.

The New File submenu of Folia Files: text, Markdown, HTML, JSON, shell, Python and Swift files, then three templates of the user's own and My Templates…

New File is in both editions of Folia Files, the one from the website and the one from the Mac App Store. It works in every pane: put several folders side by side and the file goes into the one you right-clicked.

Coming from Windows?

New File is one of the File Explorer habits a Mac doesn't have out of the box. Cut and paste with ⌘X, F2 to rename, Enter to open, a folder tree: this page goes through each one, in the Finder and in Folia Files. And to type a folder's path in Terminal without dragging it, see how to copy a file path on a Mac.

Which one to choose

  • Once in a while: TextEdit and Save. Nothing to set up.
  • At ease with Terminal: touch, the fastest, with any extension you like.
  • From the Finder's right-click: a Quick Action, built once, one per kind of file.
  • Like on Windows, with your own templates: New File in Folia Files, in any folder.