Batch adding names to mac os spelling dictionary

I work at a school, and I would like to add a number of unique names to the local dictionary so that they won't be flagged as misspelled by the spell checker.

I've discovered the local dictionary at ~/Library/Spelling/

I also see that words are added to the localdictionary text file each on individual lines.

However, when I try to paste in a large number of names (or to simply replace this file with another) I find that the new entries aren't recognized by the spell checker, even after killing the applespell process, or restarting altogether.

Ideally, I'd like to set this up so I could create a script to install this custom dictionary on all computers at the school (this works in MS Office). Is this possible?


Solution 1:

The entries in that file must be ordered lexicographically (case-insensitive).

I assume Apple implements some sort of search algorithm, so if fzgwhduef is after xdejfu, it won't be found when spellchecking it.

Edit ~/Library/Spelling/LocalDictionary, keep the entries sorted, and killall AppleSpell in Terminal to make it read the changed file the next time you use it.