2

Sorry, newbie question: I am trying to get spell checking to work in emacs on MacOSX 12.3.1

I installed emacs-plus as well as Aspell via Homebrew. I then added the following lines to my .emacs

(add-hook 'text-mode-hook 'flyspell-mode)

I also added the code from this website that was posted in another question here.

I still get the following error message:

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

Can anyone point me to a resource on how to fix this or tell me what I am doing wrong?

Thank you!

5
  • You need to install the actual spell checker aspell or hunspell or look at enchant2 to use the dictionary from macOs. IMy setup is form from macports
    – mmmmmm
    Apr 8, 2022 at 10:45
  • @mmmmmm Just to be sure I get this right: You mean it is not enough to install aspell with brew install aspell? Because that's what I have already done.
    – totti
    Apr 8, 2022 at 11:26
  • no that brew install should be OK, you might need to install the dictionary as well So what is ispell-program-name and also what does (executable-find "aspell") show - and are you on an Apple Silicon box
    – mmmmmm
    Apr 8, 2022 at 12:57
  • Yes @mmmmmm I am on Apple Silicon indeed. Is that a problem? As for executable-find, I have that in my .emacs and it just returns (Searching for program No such file or directory ispell). If Aquamacs wasn't so outdated I would probably just install that because spell checking works out of the box. At the same time, I would love to figure this out…
    – totti
    Apr 8, 2022 at 15:44
  • I agree with Aquamacs I have found too many packages that need emacs 26
    – mmmmmm
    Apr 8, 2022 at 15:55

2 Answers 2

2

You can probably fix this by setting ispell-program-name to the full path of aspell. Something like

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

The issue is that aspell is not on your path.

Homebrew for Apple Silicon puts things in /opt/homebrew which is not on the default path used by GUI apps. If you have altered the path in your shell startup files, as I think you have as brew works, then emacs run from the terminal would work.

The variable you need to add Homebrew's path to is exec-path, or set the variable for the spelling program to be an absolute path. There are packages that launch a shell to read the variables from it e.g. exec-path-from-shell and also code in Aquamacs.

My setup works without any changes as I use Macports for both emacs and aspell and the macports build of emacs includes the macports directory.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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