How to Unlearn Misspellings and Sync Your User Dictionary in OS X
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.
Thx, Adam. Good information.
Now can you explain the nonsense suggestions that appear in iOS as word bubbles over certain misspelled words? The suggestions are often non-words; I can't imagine where they come from.
Huh! No, I can't explain them, but I wonder if you might have a weird language setting wrong somewhere, such that it's offering suggestions in another language?
I have incorrectly spelled words remembered in my iOS spelling dictionary; the question is whether there is any method to get rid of them - e.g. an app?
I was afraid you'd ask that. As far as I know, no, there's no way to fix them. The closest is that you can make auto-corrections that fix them in real time. Our friend Sharon Zardetto wrote an article for Macworld on this.
http://www.macworld.com/article/2031004/how-to-make-ios-autocorrect-work-for-you.html
Paste either line into the Terminal to perform the action described in the comment.
# Reveal the file
open -R ~/Library/Spelling/LocalDictionary
# Open the file in the default text editor
open -t ~/Library/Spelling/LocalDictionary
-ccs
On iOS?
No, Christopher is just providing Terminal alternatives to some of the steps I gave that are a bit clumsy in the graphical interface. It's still all in OS X.
Very interesting, Adam.
Curiously, when I opened the Local Dictionary, I found only about a dozen words listed, which were not in alphabetical order. When I opened the en file, I found a much longer list. As an experiment, I entered a couple of the misspelled words in Nisus Writer Pro, and they were shown as okay. Then I closed the en file, option-clicked on the words to "forget spelling" and when I re-opened the en file, it had vanished.
I'm still running Mavericks, but I doubt that's the real reason. I suspect there's a preference set differently somewhere deep inside some program or another.
Yeah, that's exactly the kind of behavior I saw, but only briefly. It didn't seem to matter which app I used, but since I can't reproduce now, I don't know for sure.
Thanks for the ever useful information for minor but important things! Just to contribute to the "mystery" than an explanation which probab is quite obvious to the knowledgable. For us poor souls working in lesser countries according to Apple, we often come to rely on workarounds some times "official" and other not so. Over the years I never did a "clean" install (not that has something to do immediately), since we are talking about the user directory. `To cut the storry short, in my /Spelling there are more than the "Local.." the "en" also a " Greek", a "Multilingual". Moreover a "ps aux|grep spell" returns a service ending /GRspell.service, which is a localy added pref pane service that replaces Apple's. Over the years I remember cocoaspell and other sort of spells we restored to to cover the need of unsuplied dictionaries. The modification dates of the local spelling files are revealing : The Greek is the lastly updated ang is largest. However all the files have different content.
Oh, interesting, that confirms my suspicion that it has to do with language settings. And there may be different spelling services for different countries too... Hmm...
All my words are in the nl file (I am Dutch), there is one word in EN and nothing in localdictionary
Good! That at least makes some sense! I'll update the article to explain better.
There was a control panel called «dictionary cleaner», which worked fine for me. One can also use aspell dictionaries in OS X. These e. g. can be found in Open Office language kits. I use one with traditional german spelling.
In the French version of MACOSX 10.11.2, there is in Spelling a "fr" file which contains 21 words, mostly international ones, company or product names or acronyms (Client, Compiler, DDE, Dimension, Draw, Engine, Hispano, Inc, Insider, MacOS, Microsoft, OCI, ODBC, Runtime, Server, View, Volume, Wakanda, Webster, World, Write). LocalDictionary contains one single word : Skitch.
Definitely nothing in relation with the French langage!
But in ~/Library, there is also a Dictionary folder with a complete tree of subfolders ending up with very small UserDictionary.db files of 4 ko most of the time.
Oh, that's freaky. So what happens if you choose the French equivalent of Learn Spelling? Can you tell which file(s) get updated by looking at modified dates (and opening them if they're text files)?
Does anyone know of any third party spell checker that even vaguely approaches the wonders of Spell Catcher? I've used it extensively since it was Thunder 7, but it started getting flakey with 10.8, and is presumed dead with el cap rootless (though I haven't tried yet). Since Evan Gross died in 2012, it will never get an update. It's one of the things still tying me to snowy as my primary system. The parts I like most are the multiple dictionaries that can be easily turned off and on, catching duplicate words and letting you flag homonyms, and the statistics for reading level etc. The text replacement could be done with text expander, but it's nicer to have it all in one. I wish the family would open source it, but even if they did, it still wouldn't be as good. Evan was amazing at support as well as programming.
I've tested Spell Catcher in El Capitan. It works about as well as it does in Mavericks. Which is to say that I have to use the Input Source menu to select Spell Catcher in various apps as it no longer persists as it once did.
Thanks! That's great news! I assumed that SIP would kill it off.
Their is a simple to use free program called "Dictionary Editor", available from MacUpdate. You get a list of words in the dictionary with options to delete, add, or edit words. I have tested it in OS X 10.11.3 and it works.
I saw that while writing, but it doesn't seem to be available any more, and the company doesn't even mention it on their current Web site. It would seem sufficiently simple that it should keep working, but I could imagine it having trouble with something like the different language files, and they discontinued it to avoid having to provide support for those for whom it didn't work.
I found that the LocalDictionary file on my iMac (running Mavericks) contains a few dozen words. The en file contains roughly three times as many, but hasn't been updated in three and a half years according to the date modified on the file. Yet when I "learn" a word, it shows up in the en file, without changing the modified date. I'm going to try combining the two and sorting them with TextWrangler.
But I've been getting odd behavior from Apple's spell checking for some time now. When I add a word, it doesn't show up in LocalDictionary, but does show up in the en file—yet remains underlined and will continue to do so whenever I type it again.
I just tested this with the word TextRangler. It showed up in the en list but not in the LocalDictionary. So I copied it to the Local Dictionary list and restarted AppleSpell. And now it no longer gets underlined when I type it.
What appears to be happening is that when I "learn" a word it is placed in the en file, not in the LocalDictionary file. But spell checks are only being done from the LocalDictionary file. This explains why my system no longer appears to learn words when I tell it too—because they're added to the wrong file. It doesn't explain why this is happening. It's not a language issue as far as I can tell; I've only ever used American English on my system.
I suspect this is a bug of long standing of which Apple is either unaware, or which they cannot be bothered to fix. In any case, up till recently Spell Catcher did a much better job of checking spelling and had much more complete dictionaries.
Oh, that's freaky. If forced to guess, I'd say that you do have something "wrong" with your language settings, even if you've never touched them. Perhaps try setting your primary language to something else, restarting, and setting it back again.
OK. I was able to merge my LocalDictionary with the en file so that all the words I've "learned" to date no longer get underlined. What the Apple dictionary still does not do well is show spelling options. If I change a word only slightly, no alternatives show up when I option click it. So, hamstrung as it is, SpellCatcher is still superior. If you add a word to SpellCatcher it will usually show up in a list of options if you misspell it. Not so with the Apple Dictionary. The dictionary appears to be just one more function Apple has left to molder in mediocrity.
Anyway, Adam, thanks for helping me discover at least part of what's wrong with the dictionary function on my Mac; from that I was able to find all my learned words and suss out how to get them together in the right place. By the way, since I moved all the words from the en file to the LocalDictionary file I deleted everything in the en file so that I can easily find any new words that are learned there. Of course I saved copies of the en file and the UserDictionary file just to be on the safe side.
I'm having a completely different experience.
There is only 1 word in the LocalDictionary file "Skitch" an app installed on my Mac with Evernote. The time stamp is May 2015.
The file "dynamic-text.dat" can be opened with TextWrangler and shows all my misspelled learned words. But it is one long string, with "??" separating each word. And AppleSpell correctly underlines the words as misspelled! There are 60,000 characters all on Line 1!
I tried deleting one misspelled word and quitting AppleSpell. The word is no longer there when I reopen the file but AppleSpell still wants to turn "easy" into "easey" as if it is still cached.
The only other file in the User/Library/Spelling folder is "dynamic-counts.dat"
Both dynamic named files have a time stamp of today.
Any insights into how to work with this?
Using 10.11.3 on a MBPro 13 inch 2013. I clean installed 10.10 on it last spring, with only the user folder copied (no Apple migration) to avoid old cruft from years of Mac use
Wow. I have no idea what could be going on here. Perhaps create a new user account and see what happens in its ~/Library folder?