How to Create a Text File in a Folder on Mac

Jan 10, 2022 - 10 Comments

Create a new text file at folder on Mac

If you’re coming to the Mac from the Windows world, you may be wondering how you can quickly create a text file in a folder in MacOS. In Windows, you can simply right-click and choose to create a new text file in whatever directory you’re located in, so how can you do something similar on a Mac?

It turns out there are many ways to create a new text file in a folder on the Mac, so let’s take a look at a few different approaches.

Create a New Text File at Folder on Mac with Automator

Automator is a powerful app that allows you to script and automate things. In this case, we’ll be creating an Automator Quick Action that can be run from anywhere in the Finder to create a new text file at the current folder location. So with a little setup, you’ll have a super convenient easy to access ability to make a new text file, anywhere, anytime.

  1. Open the Automator app on the Mac, and choose to create a new “Quick Action”
  2. Make a Quick Action in Automator

  3. Use the Search function and search for “AppleScript” and double-click or drag and drop the Run AppleScript action into the workflow on the right side, then add the following AppleScript text:
  4. tell application "Finder" to make new file at (the target of the front window) as alias
    Make a new text file workflow for Finder in Automator on Mac

  5. Save the Quick Action with an obvious name, like “Create New Text File”
  6. Now go to the Finder on the Mac and navigate to a folder or directory where you’d like to create the new text file in, and pull down the “Finder” menu and go to “Services” then choose “Create New Text File”
  7. Create a new text file at current folder on Mac

  8. A new blank text file will be created, named ‘untitled’
  9. New text file created at folder on Mac

You can use this Quick Action anywhere in the Finder to instantly generate a new text file.

This is probably the closest Mac action to the Windows right-click ‘Create new text file’ functionality.

Creating a New Text File in any Folder on Mac with TextEdit

The TextEdit app on Mac is basically like WordPad in Windows, and with it you can create new text documents or rich text documents where ever you’d like to.

  1. Open TextEdit on the Mac
  2. Use your new text file, or go to File menu and choose New to create a new text file
  3. Save the TextEdit document by going to File > Save
  4. Select the folder path to where you’d like to save the new text document to

This is how saving files works in general on the Mac, so there’s nothing particularly magical or special about this approach to saving a TextEdit text file into the desired folder on the Mac.

Creating a New Text File at Any Location on Mac with Terminal

Finally another method you can use to create a new text file at any location is the Terminal application:

  1. Open the Terminal app on Mac
  2. Use the following command to create a new text file at a desired location:
  3. touch text.txt

  4. For example, to create a new text file on the Mac desktop, the following command could be used:
  5. touch ~/Desktop/text.txt

The Terminal is considered a bit more advanced but the touch command is simple, and can be used to point anywhere in the file system to create a new blank text file.

How did these methods work for you? Do you have another approach of creating new text files at specific locations on the Mac? Which method do you use? Let us know your thoughts and experiences in the comments.

.

Related articles:

Posted by: Paul Horowitz in Mac OS, Tips & Tricks

10 Comments

» Comments RSS Feed

  1. Genny says:

    How I can obtain a new text file already with extension txt using your script?

    on run {input, parameters}
    tell application “Finder” to make new file at (the target of the front window) as alias
    return input
    end run

  2. Roman says:

    This is a 🔥

  3. Nathan says:

    The AppleScript-based version works just fine if you put it into a Shortcuts Run AppleScript With block. Probably best to use Shortcuts instead of Automator these days to get a little more futureproofing.


    on run {input, parameters}
    tell application "Finder" to make new file at (the target of the front window) as alias
    return input
    end run

  4. AbdulHadi says:

    You are awesome. Thank you for this article

  5. Marcin says:

    I’ve been looking for something like Windows right click to create new file. The Automator version works for me, Thanks

  6. Uwe says:

    Does not work with Monterey. Error!
    „«class fvtg» of window 1 of application “Finder” cannot be converted to type alias.

  7. Gino Pilotino says:

    It’s not working for me (maybe cause I’m on italian localized OSX?)

    Anyway the error I get is:
    Action “Run AppleScript” has detected an error:
    “Cannot transform of window 1 of application “Finder” to kind alias.”

  8. Maddie says:

    Thanks! I needed this. So useful! 😊

    • John Furlong says:

      The ‘New File Menu’ app also does this very effectively in addition to offering creation of new files for other apps e.g. Pages, Numbers, Keynote and Open Document files (if you’ve got Libre Office installed)

Leave a Reply

 

Shop on Amazon.com and help support OSXDaily!

Subscribe to OSXDaily

Subscribe to RSS Subscribe to Twitter Feed Follow on Facebook Subscribe to eMail Updates

Tips & Tricks

News

iPhone / iPad

Mac

Troubleshooting

Shop on Amazon to help support this site