Every Monday, we’ll show you how to do something new and simple with Apple’s built-in command line application. You don’t need any fancy software, or a knowledge of coding to do any of these. All you need is a keyboard to type ’em out!
Writing in the Terminal provides a distraction-free environment to get your thoughts onto digital paper; however, you may be missing a crucial modern-day writing convenience: spell checking. With a little command line utility called “spell,” you can easily see where spelling mistakes lie within your documents. Continue reading, and we’ll show you how to edit your way through a document in the Terminal.
Installing Spell
To install spell, you’ll need either Homebrew or MacPorts installed on your machine. Once you have that, open the Terminal and type in the following command:
In the case of Homebrew being installed, type:
brew install aspell
In the case of MacPorts being installed, type:
sudo port install aspell
If you are using MacPorts, you will be prompted to enter your administrator password before proceeding with the download and install. After installation, you’ll be returned to the terminal prompt.
Check a Document
To check the spelling of your document, we’ll use the aspell command to open a file and compare the words in the document against its built-in dictionaries. To do this, type the following command into the Terminal:
aspell -c file.txt
Replace “file.txt” with the file path and file name of the document that you wish to spell check. This will launch the interactive spell checker (interactive in the sense that you will be correcting the words in the document in the provided interface).
Your document will be opened, and the highlighted words will be words that the aspell program has detected as improperly spelled. To correct the spelling, you will type in the number that corresponds to the appropriately spelled word.
Once you have reached the end of your document, the changes will be saved, and you will be returned to the command prompt, ready to enter a new command.
Cory Bohon is a freelance technology writer, indie Mac and iOS developer, and amateur photographer. Follow this article’s author on Twitter.