Native Mac Way to Create Text Files via Finder Menu?

NewFileClick has been convenient. Especially when I need to create new JS / C++ files. Don’t think it works with cloud folders

Hi and welcome.

What does it mean to create a “new JS …” file? Is it just a text file with the extension .js? Or is it more of a file template, perhaps user definable? It is not clear from the website or AppStore descriptions.

Thanks.

How long I struggled to create the best solution for this! Ultimately, I created a macOS Shortcut called “Create new file here”, which I launch via right-click → Quick Actions.

The Shortcut then prompts for a filename, which defaults to untitled.txt.

The file is created using a Bash script (touch command). If a file with that name already exists, it will append a number afterward.

Here is the Shortcut with the Bash script.

Make sure that the Shortcut is set-up properly to run in Finder and via the Services Menu.

I hope that helps someone out there! This took me forever to figure out. Now I use it all the time!

It is easily a feature that should simply be baked into macOS.

4 Likes

It works really well. To go even further, you can create a variant that will use the currently selected folder in the finder, and put the shortcut in the Finder toolbar

To put the shortcut in the toolbar, add shortcut to the dock, go to /Users/<your_user>/Applications where it has been added, hold cmd while you drag the shortcut in the toolbar :slight_smile:

1 Like

Have you tried other right-click enhancer tools such as iBoysoft MagicMenu ? It can help you effortlessly create a new file ( text, pdf, note, excel, word document, etc) via the Finder menu, and move /transfer/quickly access a document etc.

Sindre Sorhus’ Supercharge allows to create any file using the Finder context menu or with a keyboard shortcut, along with a million other things that may or may not be useful to you. And he’s just getting started. At the price, it’s a steal.

4 Likes

I think you could modify it yourself using Karabiner Elements or something similar.

1 Like

I think I might have found the best way to create text files in finder — but not through a context menu. I made this work using the Automator script below, and then making a keyboard shortcut in System Preferences. I’ve detailed the how-to here on my blog.

Here’s the Automator script, use “Run Applescript” and “no-input” and “Finder.app” selected:

on run {input, parameters}
    tell application "Finder"
        if (count of windows) is not 0 then
            set currentFolder to (target of front window) as alias
        else
            set currentFolder to (desktop as alias)
        end if
    end tell
    set folderPath to POSIX path of currentFolder
    if folderPath does not end with "/" then
        set folderPath to folderPath & "/"
    end if
    set fileName to text returned of (display dialog "Enter file name:" default answer "untitled.txt")
    set filePath to folderPath & fileName
    do shell script "touch " & quoted form of filePath
    try
        if fileName starts with "." then
            do shell script "open -a TextEdit " & quoted form of filePath
        else
            do shell script "open " & quoted form of filePath
        end if
    on error errMsg
        display notification "Could not open file automatically: " & errMsg
    end try
    return input
end run
2 Likes

Very nice!

Press ⌥N. Creates a file named untitled.txt with the file name ready to be edited. Then the file gets opened in my quick editor of choice.

Already have a Setapp subscription.

I still love my shortcut (described above). Works great!

Hi everyone. take a look at this ap at App Store called PowerClick that handles it natively.

It adds a simple “New File” option to the regular right-click menu, but it lets you create any file type you want, not just basic .txt files. (It also works perfectly inside Dropbox/iCloud folders, which was an issue with older apps).

It randomly has a clipboard history and snippet manager built into the same menu too, which turned out to be super handy. Just thought I’d drop it here for anyone who needs. https://powerclick.kilicov.dev/

When I select Finder window with the destination folder selected and run the macro, I get this error .

Any ideas on how to get it to work?

I tried the shortcut method, too, but it doesn’t have a create file action. I am really stuck!

Hard to say without seeing your macro. I just tested it again, and it creates a new file in the frontmost Finder window. Did you try a new macro with a single File Action? Are you using Keyboard Maestro v10.0+?

I copied your macro from the screenshot that you provided, clicked on a finder window, then pressed the hotkey ( hyperkey + S ) to run it. I’m running KM v11.0.4

After I posted the error , I found another macro in a macro file, imported it , and clicked on finder, and then pressed the hotkey to activate it, and it worked.

Screenshot of the imported macro

Which is a bit different than the one you shared

Strange. I’m not sure why the single action isn’t working for you, but glad you found a solution.