I use the flyspell-mode as a spell checking mechanism in emacs. Recently, I moved to Mac OS X, and I began to get this error whenever I started emacs:

Error enabling Flyspell mode:
(Searching for program No such file or directory aspell)

I had installed aspell with Homebrew. The issue seemed to be that Emacs was unable to find the aspell binary. Homebrew installs binaries in /usr/local/bin and it was in my $PATH. It turns out Emacs uses it’s own exec path to look for binaries to execute in sub-processes. So the fix is to add the /usr/local/bin path to the exec-path. This is the change needed to the ~/.emacs file:

 '(exec-path (quote ("/usr/bin" "/bin" "/usr/sbin" "/sbin" "/usr/local/bin"))))

Notice the /usr/local/bin in there.


This does not seem to work. A better way to do this is to add the following:

(setenv "PATH" (concat (getenv "PATH") ":/usr/local/bin"))
(setq exec-path (append exec-path '("/usr/local/bin")))

If you have questions or comments about this blog post, you can get in touch with me on Twitter @sdqali.

If you liked this post, you'll also like...