emacs on mac os x, how to get spell check to work

LWZ picture LWZ · Sep 26, 2013 · Viewed 16.2k times · Source

I'm moving from Windows to Mac, and I've spent the whole night trying to get emacs to work.

I've installed GNU emacs and simply copied over my Windows .emacs file, which seems to work ok, except for spell check. I installed cocoAspell and followed this setup instruction to add the path and change ispell to aspell, but when I run spell check, I got

Error: The file "/use/local/lib/aspell-0.60/english" can not be opened for reading.

and FlySpell does not work either.

It seems like it's looking at the wrong directory, but I already have

(setq ispell-program-name "aspell"
      ispell-dictionary "english"
      ispell-dictionary-alist
      (let ((default '("[A-Za-z]" "[^A-Za-z]" "[']" nil
                       ("-B" "-d" "english" "--dict-dir"
                        "/Library/Application Support/cocoAspell/aspell6-en-6.0-0")
                       nil iso-8859-1)))
        `((nil ,@default)
          ("english" ,@default))))

which points to the right dictionary directory "/Library/Application Support/cocoAspell/aspell6-en-6.0-0". I can't figure out why I got the error and how to fix it.


Update:

Now I have removed my GNU emacs and cocoAspell, and re-installed (and linked) emacs/aspell using homebrew as @katspaugh suggested. I removed the code shown above, leave only

(setq ispell-program-name "aspell")

Now when I run spell check, I got

Searching for program: No such file or directory, aspell

I have already linked aspell with brew link aspell, why it still cannot find it?

Answer

katspaugh picture katspaugh · Sep 26, 2013

Here's a working solution:

  • Install Homebrew
  • brew install emacs --with-cocoa --with-gnutls
  • brew install aspell
  • open -a Emacs
  • M-x ispell

Enjoy!