There are several ways to create a text file on your Mac. Two of the easiest are TextEdit and Automator, which come installed on Macs by default. This article provides a step-by-step guide on how to create a .txt file on your computer.
Contents:
- What is a .txt file?
- How to create a text file with TextEdit on a Mac
- How to create a text file on Mac with Automator
Before we start
MacCleaner Pro is an all-in-one software solution to clean up and speed up your Mac. It helps clear all junk files like caches, service files from already-removed applications, duplicate files, unused bulky files, and more.
MacCleaner Pro
What is a .txt file and what is it used for?
In short, a text file is a simple text document that can be created, viewed, and edited by any text editor application. Text files usually (but not always) have the extension .txt.
The .txt extension is used for text files that contain plain text, like a letter to a friend or a diary entry. These files can be opened and read in word processing programs such as Microsoft Word or Apple’s Pages. ‘Plain text’ means that the file contents are not formatted in any way – it’s just a list of characters. Text files don’t contain any fonts, colors, formatting, or images, like .pdf or .docx files can have.
Text files are the simplest way to store text on your computer. They’re sometimes used for storing notes, writing down shopping lists, resumés, cover letters, forms, and for other simple files that don’t require adding images, graphs, and other content. If you’re looking for more sophisticated functionality and document protection, then it’s better to use an alternative like Word or Pages.
How to create text files using TextEdit on a Mac
TextEdit is a free word processing program for Mac. It comes pre-installed on every Mac computer and is easy to use. If you don’t have Microsoft Office available and don’t want to bother with free alternatives like OpenOffice, then TextEdit is a fine alternative. It offers most of the basic word processing tools you’ll need, and it’s simple enough for beginners to get the hang of right away. Here’s how to use it:
- Open Finder and go to the Applications folder.
- Find and open the TextEdit app from there.
- Once the app is open, go to its settings and ensure that the Plain text option is selected. Here, in the TextEdit settings, you can also customize other options, like font, properties, checking spelling, and more.
- Close settings.
- Select File → New or press Cmd+N to create a new document.
- Type in your text or copy and paste it into the TextEdit window.
- To save the .txt file, select File → Save. Type in a name for your file, choose where to save it, and click the Save button.
Congratulations; you’ve created a text file on your Mac!
Note that you can also easily switch to Rich Text mode if you want to format your text. For this, click Format in TextEdit’s menu bar and select Make Rich Text. If you change a Rich Text document to a Plain Text document, it will lose all formatting settings.
How to create a text file with Automator
Automator is another built-in macOS application that can automatically create .txt files using a script. For example, you can create a quick action in Automator that will let you create a text file from anywhere in Finder. Here’s how to do this:
- Open the Automator app from Launchpad or the Applications folder.
- Choose to create a Quick Action.
- In the sidebar, find the Run AppleScript option and drag and drop it to the right panel of the window.
- Copy and paste the following script into the window:
set file_name to “untitled”
set file_ext to “.txt”
set is_desktop to false
— get folder path and if we are in desktop (no folder opened)
try
tell application “Finder”
set this_folder to (folder of the front Finder window) as alias
end tell
on error
— no open folder windows
set this_folder to path to desktop folder as alias
set is_desktop to true
end try
— get the new file name (do not override an already existing file)
tell application “System Events”
set file_list to get the name of every disk item of this_folder
end tell
set new_file to file_name & file_ext
set x to 1
repeat
if new_file is in file_list then
set new_file to file_name & ” ” & x & file_ext
set x to x + 1
else
exit repeat
end if
end repeat
— create and select the new file
tell application “Finder”
activate
set the_file to make new file at folder this_folder with properties {name:new_file}
if is_desktop is false then
reveal the_file
else
select window of desktop
set selection to the_file
delay 0.1
end if
end tell
— press enter (rename)
tell application “System Events”
tell process “Finder”
keystroke return
end tell
end tell - In the Automator menu bar, click File and select Save.
- Type a name for the command, for example, Create TXT File, and click to save it.
- Once you do this, you can create a .txt file using Finder. For this, click Finder in the menu bar, select Services and choose the ‘Create TXT file’ command that you just created. (You may have another name for this option.)
- A new text file will be immediately created on your desktop.
Conclusion
We hope this article has helped you figure out how to create a text file on a Mac. It’s possible to create a text file using the TextEdit application or by creating a script command for Finder using Automator. Note that there are also many alternative software tools for creating a text document on your Mac. Let us know in the comments if you have any questions, and we’ll try to help.