How can you hack the LocalDictionary on a Mac system?

Another question about the built-in Mac spell dictionary. (I did read the previous question How can I forget or edit a learned word in the Mac spelling dictionary?)

Under User>Library>Spelling> I have both LocalDictionary and en.

What is the relationship between these two? Adding a great number of specialized, technical words one at a time as they appear in my writing is taking a lot of time. Is there a way to add a great number of (specialized) words to one of these?

Dave’s Answer:

Great question and an interesting one both, because it turns out that the Mac OS X spelling subsystem that underlies its common spelling capability is eminently hackable. How can you tell? Simply open up the LocalDictionary file that you reference.

Before I do, however, I will say that it’s important to use the right editor: if you use an editor that adds the wrong line-end sequences, you can presumably mess up the dictionary. My suggestion, since I’m comfortable with the command line, is to open up and use either “emacs” or “vi” to add content to the file. Save the original file before you start, though, and presumably you could also just try something else like BBEdit, TextEdit or even Microsoft Word. It messes up? Just copy back the original!

Even if you don’t want to hack the file, you can still open it up and have a look by using TextEdit. Launch the program, then navigate to Library > Spelling and open “LocalDictionary”.

Here’s what mine contains:

textedit mac localdictionary 1

Does it work? To test it while in TextEdit, I added the nonsense word “ptoi” and saved the file, then opened a new TextEdit window and typed that word in to the window. The result was that it was still marked as a spelling error. Hmm…

To test further, I logged out and logged in again. The result:

textedit mac localdictionary 2

No red squiggly line means that “ptoi” is now a valid word with an understood spelling.

Sweet! So there ya go. You don’t need to use or the command line, you simply need to open up the file with TextEdit and add the words you need, save it, and you’re good to go. Nice job making this easy to work with, Apple!


Categorized as Mac

By Dave Taylor

Dave Taylor has been involved with the Internet since 1980 and is internationally known as an expert on both business and technology issues. Holder of an MSEd and MBA, author of twenty books and founder of four startups, he also runs a strategic marketing company and consults with firms seeking the best approach to working with weblogs and social networks. Dave is an award-winning speaker and frequent guest on radio and podcast programs.