Don’t you hate it when you accidentally tell OS X’s spelling checker to learn a misspelled word, rather than correcting it? Let me show you how to fix that.
This just happened to me. I was editing some text and ran across the misspelling “stegonography” (when properly spelled as “steganography,” it means the practice of concealing messages within other seemingly innocuous text or data). OS X’s spelling checker alertly underlined it in red to indicate that it was wrong. I Control-clicked it to get the proper spelling, but my finger slipped, and I inadvertently chose Learn Spelling, which added it to my local user dictionary. Curses!
(Just to make sure we’re all on the same page of the Mac 101 textbook… when you type a word that the spelling checker doesn’t recognize, it will be underlined in red. Control-click it to display a pop-up menu that offers correctly spelled alternatives along with commands to learn the word if it’s right or ignore it if it’s correct in context.)
If you’re in Pages, TextEdit, Nisus Writer Pro, BBEdit, or the like, you can Control-click the word, which will no longer have that red underline, and choose Unlearn Spelling to reverse your action. But if you’re in Safari, Google Chrome, or any other app that supports spell checking without implementing it fully, no Unlearn Spelling command is available.
The clumsy solution is to copy the offending word, paste it into TextEdit or a similar app, Control-click it there, and choose Unlearn Spelling from the pop-up menu. Effective, but awkward, particularly if you’ve ended up with a number of misspelled words in your dictionary over the years.
Here’s an alternative solution — you can edit your list of learned words directly, since it’s just a text file. Follow these steps:
- In the Finder, press the Option key and choose Library from the Go menu to open your account’s Library folder.
- In the Library folder, find the Spelling folder, and open it.
Double-click the LocalDictionary file to open it in TextEdit (or whatever app you use for text files). If you are in a different English-speaking part of the world or use a different language, you’ll instead want to look for a file named for your region or language, such as en_CA for Canada or nl for Netherlands.
Scroll through, deleting any incorrect words.
You can also add words here, but make sure to keep them in strict alphabetical order or sort the list with an app (see below). This would be a good way to add a lot of technical, medical, or scientific terms quickly. Either way, maintain one word per line.
When you’re done, save the file.
Finally, launch Activity Monitor from
/Applications/Utilities, click the Process Name column header to sort by name, and look for AppleSpell. (If you use a different language, you may have a different process; a Greek reader reported that his was called GRspell. Search for “spell” in Activity Monitor if you don’t see AppleSpell.)
Select it and click the X button in the upper left corner of the Activity Monitor window, then click Quit in the dialog that appears.
Without this last step (or a restart), AppleSpell won’t see your changes in LocalDictionary. After you quit AppleSpell, it restarts automatically after a few minutes, or the first time you Control-click a word.
Sync Dictionaries across Macs — If you think about it, knowing that all your learned words are in a file gives you another interesting capability. If you have multiple Macs, and want the same set of learned words on each of them, you can copy the LocalDictionary (or whatever your system uses) file from one Mac to another and then quit AppleSpell or restart.
You could even merge two of these learned word files from different Macs, as long as you have some way of sorting the lines alphabetically — I’d do that in BBEdit or the free TextWrangler, both of which have a Sort Lines command in the Text menu.
There is one quirk that I haven’t yet been able to figure out entirely. In the
~/Library/Spelling directory on my iMac, there’s also a text file called en, which contains a subset of the words in LocalDictionary. (On my MacBook Air, it has only a handful of words.) In my initial testing, learning a word updated the en file instead of LocalDictionary, which caused me some confusion. But when I realized what was happening and started some rigorous testing, that behavior stopped and nothing I do affects en any more.
I believe the use of a file other than LocalDictionary is related to language settings in the Language & Region pane of System Preferences, since I now have confirmation from people in other countries that their Macs use learned word files named for their language or region, such as nl for Netherlands and en_CA for Canada. And a Greek reader reported that his file was called Greek, not gr. But no matter how I fiddle with the language settings, I can’t make anything interesting happen with the en file on my Mac.
This minor mystery notwithstanding, I hope you find this advice useful in cleaning up your learned word list and ensuring that spell checking works the same on all your Macs.