MacOS – Locating the file in which a dictionary word is stored

dictionarymacosspellcheck

I misspelt the word "analogous", and I found that the system spellchecker offered "anbalagous" as a possible correction. As far as I can tell, "anbalagous" isn't a real word, so I figured I must have added it to the dictionary at some point by mistake.

However, it seems that "anbalagous" isn't in ~/Library/Spelling/LocalDictionary, so it's a bit of a mystery. Out of curiosity, I would like to check which file the word "anbalagous" appears in. So:

  • where are the spell check dictionary file(s) located on a Mac?

  • is there any location other than ~/Library/Spelling/LocalDictionary where custom words are stored for the system spell checker?

  • if (as I suspect) the dictionary is stored in a binary file, is there a way to see the list of words in it?

  • (Probably not but might as well check) does a Mac's spell checker dictionary contain the word "anbalagous" by default?

In case it makes a difference I'm still on OS X 10.11.

Best Answer

Through a process of elimination, I have determined that the word is (erroneously) in the system wide spell checker.

  • The file isn't in your local spell check dictionary. This is easy to check - simply edit the file ~/Library/Spelling/LocalDictionary. You can also issue the following command to search directly from the command line

    % grep -i anbalagous < ~/Library/Spelling/LocalDictionary
    

  • Apple utilizes a spell checker called Hunspell which is an open source spell checker based on MySpell. (also found on https://opensource.apple.com) The dictionary (en_US.dic) are plain text files and can easily be viewed/edited. Issuing the following command on the downloaded dictionary file yields no results; it's not in the public dictionary from Hunspell.

    % grep anbalagous < hunspell-en_US-2019.10.06/en_US.dic
    

  • AppleSpell appears to be their proprietary spelling and grammar checker product as it isn't found on https://opensource.apple.com/source/ (listing of open source projects used by Apple). The version.plist file found in /System/Library/Services/AppleSpell.service/Contents makes reference to the "ProjectName" being "ProofReader".

  • There are additional word lists (spelling dictionaries) found in /usr/share/dict. Searching each one for the word in question produced no result either. Eg:

    % grep -i anbalagous < ~/usr/share/dict/words
    

  • On a FreeBSD 12-1 VM, I installed the hunspell and en-hunspell (en-US dictionary) ports. Anbalagous is identified as misspelled; so the hunspell engine and dictionary appear to be working.

  • Finally, on a clean install of Catalina, I tested the word anbalagous and it doesn't trigger the spell check. It appears it's in the spell check dictionary/word list supplied from Apple or there is possibly a bug in Apple's implementation of the spell checker.

Since I can't seem to find a dictionary with that misspelling and the open source tools which Apple bases their spell checker seem to function correctly, I filed a bug report with Apple at https://www.apple.com/feedback/macos.html; I encourage you to do the same.