27

I'm using brew as my package manager for both Emacs and ispell. I have both installed. Doing a quick google, I was unable to figure out how to tell Emacs where ispell is and to load the appropriate dictionaries.

Right now when I do a M-x ispell-check-version, Emacs saucily replies: Searching for program: No such file or directory.

How do I configure Emacs to use ispell?

15

The variable you're looking for is ispell-program-name. Stuff this somewhere in your .emacs:

(setq ispell-program-name "/path/to/ispell")

Or use M-x set-variable, etc.

References:

  • From the sources to ispell.el

    (defcustom ispell-program-name
      (or (locate-file "aspell"   exec-path exec-suffixes 'file-executable-p)
          (locate-file "ispell"   exec-path exec-suffixes 'file-executable-p)
          (locate-file "hunspell" exec-path exec-suffixes 'file-executable-p)
          "ispell")
      "Program invoked by \\[ispell-word] and \\[ispell-region] commands."
      :type 'string
      :group 'ispell)
    
  • See also: http://emacswiki.org/emacs/InteractiveSpell

Whenever you can't find an Emacs function, remember C-h f (or a variable: C-h v). Entering ispell at the Describe function prompt tells you that ispell is an interactive compiled Lisp function in 'ispell.el'., and from there you can usually find what you're looking for.

  • 1
    If you use set-variable to set ispell-program-name make sure you put double quotes around the value. In my case it was "/opt/local/bin/aspell" – Jistanidiot Aug 28 '14 at 14:35
11

What helped me solve this without editing my .emacs with absolute paths (which I was reluctant to do, as I share the file between different OSs) was installing ispell via brew

brew install ispell --with-lang-en

as explained in this answer (and my comment).

1

This is an environment variable issue. The exec-path-from-shell package fixed this problem for me.

After evaluating (exec-path-from-shell-initialize), ispell worked.

0

Even if you use brew only for the ispell install and have installed emacs from this type of dmg, and you run emacs from an icon in the dock, you'll want to logout and login again, since OS X caches items in your path and won't see ispell immediately. If this information isn't news to you, then you can probably work around this issue anyway.

0

Pretty sure this must be a resolved issue by now, but still wanted to add that I have been successfully using ispell in Mac OS X. Installing ispell in homebrew and then adding the correct path in .emacs (/usr/local/bin) solved the problem for me.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.