Go to page:

Search:   Help

Developers' side bar

Selected categories


Shared groups



Categories: Development
<< | Page list | >>

Notes about setting up and using Hunspell in LyX.

Note: Beginning with 2.0 support for the Aspell command line program has been dropped. Although the aspell library (aspell 0.60.x) is still supported, Windows binaries are compiled without this feature. Windows users should thus use either Hunspell or Enchant.


Hunspell is located on SourceForge.

Hunspell is a spell checker originally based on MySpell and backward-compatible with MySpell dictionaries, however can also use Unicode UTF-8-encoded dictionaries. LyX provides support for Hunspell beginning with the 2.0 release.


To get Hunspell working with LyX, you will need to install Hunspell along with several dictionaries. You can install the dictionaries via your OS package manager (in case of Linux), or you could copy them from LyX's SVN repository (the 'dicts' subdirectory).

You will also need to select Tools > Preferences > Language > Spellchecker > Engine > Hunspell and optionally check 'Spellcheck continuously'. Additionally, you must indicate the PATH to the Hunspell dictionaries and restart LyX. To do so, access Tools > Preferences > Paths > Hunspell and insert the path to your dictionaries. If you installed the Hunspell dictionaries via the OS package manager (such as Synaptic on Ubuntu), the path would typically be '/usr/share/hunspell' or '/usr/share/myspell/dicts'. On Ubuntu 12.04, myspell packages (e.g. myspell-es for Spanish) are installed under '/usr/share/hunspell'. If you copied them from LyX SVN to a random dir such as '/usr/local/build/lyx-hunspell', you would need to specify '/usr/local/build/lyx-hunspell/dicts' into the Preferences > Path. Do not forget to restart LyX to check that Hunspell works in your LyX installation.

Troubleshooting for linux

In case dictionaries are not found
1) check that you have dictionary & affix files (or links to them) in one of:

~/${BUILD_PREFIX}/dicts (usually /usr/share/lyx/dicts)
~/${PREFIX}/dicts (usually ~/.lyx/dicts)

("lyx -dbg files" is your friend to check where LyX is actually looking)

2) check the naming of hunspell dictionary itself.
LyX checks for dictionary name based on the scheme lang_COUNTRY.dic, lang_COUNTRY.aff (alternatively lang-COUNTRY.dic/aff). If for some reason your distro use different scheme for particular dictionaries (e.g. de_DE_frami.dic instead of de_DE.dic) then you need to create soft links to make LyX machinery work (e.g. de_DE.dic/aff -> de_DE_frame.dic/aff).

Building LyX with hunspell

First build hunspell (i.e., configure, make, make install). If system privileges are insufficient to install to the system, use --prefix=... to define an install directory. For this example, we will assume that directory is $HOME/SRC/hunspell_install.

Within LyX, use the configure command:

../configure --with-extra-inc=$HOME/SRC/hunspell_install/include/ --with-extra-lib=$HOME/SRC/hunspell_install/lib/

During the configure, you may see

checking for HUNSPELL... checking hunspell/hunspell.hxx usability... yes
checking hunspell/hunspell.hxx presence... yes
checking for hunspell/hunspell.hxx... yes
checking for main in -lhunspell... no
checking whether to use hunspell... no

To get these final two entries changed to "yes" and permit building with hunspell, you can create a symlink in $HOME/SRC/hunspell_install/lib of libhunspell.so pointing to libhunspell-1.5.so.0.0.0 (or whatever other version is appropriate).


Category: Development

Edit - History - Print - Recent Changes - All Recent Changes - Search
Page last modified on 2016-07-12 17:11 CEST