MacOS Finder New Markdown File

tl;dr

Apple Script that will create a new Markdown file in the current folder, copying the filename to the first line as a H1.

Description

MacOS Finder does not have any simple ways to create new files. The following Apple Script will create a new Markdown file in the current folder (or if the user does not have permissions, on the Desktop). The script will ask for a name and set the first line the the name with a # making it a H1.

Create the Apple Script

Open Script Editor.app, click on New Document to create a new document.

Paste in the following:

(Not sure where this code originally came from, scraped it from the web ages ago, if you recognize it, let me know?)

  • Select File menu, Export
  • Set filename to New File
  • Set Where to your local Applications directory, which should be the default
  • Set File Format: to Application
If you have an Apple Developer account with a Mac Development Identity, select it in the Code Sign dropdown. This will prevent a nag screen “New File” can’t be opened because it is from an unidentified developer.

Click Save. If you want, save the source script file so you can edit it later. When done, close Script Editor.

Add to Finder Toolbar and Test

Find the New File.app in your user’s Applications directory, Command + Click and drag the New File.app to the Finder toolbar.

To edit the position and spacing of the toolbar button, Control + Click on the toolbar and select Customize Toolbar....

To test, navigate to a directory and click the new button on the toolbar.

Comments are closed.