Installing Hunspell on FreeBSD and macOS


Hunspell is an excellent spell checking library written by László Németh I only learned of since trying emacs. Yes, that’s happening! It’s also the spell checker used for LibreOffice,, and Mozilla applications. It requires installation of the library, and one or more word lists to compare words against.

On macOS you can use Homebrew or pkgin to get the latest version, but the dictionary files may be missing or outdated:

$ brew install hunspell
# pkgin install hunspell

The alternative is to download and install wordlists manually. macOS used to place its dictionaries in /Library/Spelling, and hunspell is still set to look for them there. Assuming you’ve downloaded a language and need to unzip:

# mkdir /Library/Spelling
# unzip -D /Library/Spelling

FreeBSD installation is straightforward using ports or packages. The en-hunspell package includes all major English language flavours, some of which even spell flavours correctly:

# pkg install hunspell en-hunspell

You may also require setting environment variables so tools like emacs can find the dictionaries and the correct language. For example, place these in your Bourne-compatible shell config if you’re on macOS:

export DICTIONARY=en_GB-ise
export DICPATH=/usr/local/share/hunspell (FreeBSD)
export DICPATH=/Library/Spelling (macOS)

You can now confirm which wordlists are detected and installed:

# hunspell -D
AVAILABLE DICTIONARIES (path is not mandatory for -d option):

Using these in emacs will be in a future post.

Author bio and support


Ruben Schade is a technical writer and infrastructure architect in Sydney, Australia who refers to himself in the third person. Hi!

The site is powered by Hugo, FreeBSD, and OpenZFS on OrionVM, everyone’s favourite bespoke cloud infrastructure provider.

If you found this post helpful or entertaining, you can shout me a coffee or send a comment. Thanks ☺️.