Recent Posts


Installing Aspell on OS X


Frustrated by Magento? Then you’ll love Commerce Bug, the must have debugging extension for anyone using Magento. Whether you’re just starting out or you’re a seasoned pro, Commerce Bug will save you and your team hours everyday. Grab a copy and start working with Magento instead of against it.

Updated for Magento 2! No Frills Magento Layout is the only Magento front end book you'll ever need. Get your copy today!

Another in a series of “How Did I do that Again?” tutorials.

For reasons of heavy nerdery I wanted a command-line spell checker installed on my computer. The last time I tried this, I ran into a bunch of license related wonk around the ispell package, and decided I didn’t want a command-line spell checker all that much.

This time around I looked into aspell. I was slightly dismayed that a preliminary google search only turned up installation instructions for the various (atrocious) OS X package managers. That usually indicates there’s a bunch of license related wonk that precludes a straight configure/make/make install. (I have no problem with a good package manager, but the last time I tried Fink and/or Darwin Ports it was more work than manually compiling things)

Turns out it’s relatively straight forward to install the aspell application. The only wonk involved is needing to install the dictionary separately, as well as some optional script installs to provide compatibly for applications that expect you to have the “ispell” or “spell” program installed.

These instructions worked for me, running Mac OS 10.4 and using the english dictionaries. Standard caveats about your varying milage and bricking of computers apply. I am not your sys-admin.

Download and Extract the aspell Source

First, you’ll want to download the latest aspell source. As of this writing, that was version 0.6. From the command line

$ curl -LO
$ tar -zxvf aspell-0.60.tar.gz

Download a Dictionary Source

Next, in the same directory, let’s download the dictionary files that aspell will use. This will be installed separately from the main apsell package. As I’m a damn yanqui anglophile, I’ll be downloading the english dictionary.

$ curl -LO
$ bunzip2 aspell6-en-6.0-0.tar.bz2
$ tar -xvf aspell6-en-6.0-0.tar

Be sure to download the dictionary that corresponds to the version of aspell you downloaded in the previous step (aka. 0.6 here)

Configure/Make/Make Install aspell

Now we’ll drop into the aspell folder and run the standard unix “build from source” commands. Apell is setup, by default, to install in the /usr/local folder, I’m just including the –prefix option for the sake of completeness.

$ cd aspell-0.60
$ ./configure --prefix=/usr/local
$ make
$ sudo make install

Copy the optional ispell and spell scripts

For the sake of thoroughness, let’s copy over the spell and ispell compatibility scripts. You won’t want to overwrite an existing spell or ispell installation, so we’ll use the -n flag for the cp command, which prevents an existing file from being overwritten.

$ sudo cp -n scripts/ispell /usr/local/bin
$ sudo cp -n scripts/spell /usr/local/bin

In the grand unix tradition, there’s no feedback when a file isn’t copied. If you like more transparency from your cp command, try the -i flag instead, which will prompt you for each existing file it finds.

Configure/Make/Make Install the Dictionary

So, aspell is installed, but it’s a bit useless without the dictionary files. These need to be installed separately. The dictionary install assumes that aspell is in your PATH. You can test this from a terminal by typing the following

$ which aspell

This will tell you which aspell command would run if you typed it from the command line. If there’s nothing found, you’ll need to add /usr/local to your PATH. There are countless ways to do this, but the easiest is to add the following line to the end of your ~/.bash_profile file

export PATH=~/bin:/usr/local/bin:$PATH

.bash_profile is a hidden file that gets executed anytime you startup a bash shell (aka, open a terminal window). If you’re not running the bash shell the syntax will be different, but if you’re clever enough to run a non-default shell you’re clever enough to figure this out on your own.

That bit of work out of the way let’s install the dictionary. Assuming you’re still in the aspell folder (and that you downloaded the english dictionary), just

$ cd ../aspell6-en-6.0-0
$ ./configure
$ make
$ sudo make install 

Go to Town

You’re now set to nerdily spellcheck text files to your heart’s content.

$ aspell -?                 #for usage
$ aspell -c /path/to/file   #to spellcheck a file
Originally published December 21, 2007

Copyright © Alan Storm 1975 – 2022 All Rights Reserved

Originally Posted: 21st December 2007