3

While coding Haskell in emacs(stack installed with brew) on MacOS 10.12 I get the error:

Error while checking syntax automatically: (file-error "Searching for program" "no such file or directory" "stack")

My config file .emacs contains the following:

(require 'package)
add-to-list
'package-archives
'("melpa" . "http://melpa.org/packages/") t)
(package-initialize)
(package-refresh-contents)
(package-install 'intero)
(add-hook 'haskell-mode-hook 'intero-mode)

Running with emacs --debug-init gives no errors.

Does somebody know how to solve this?

6
  • 1. issue M-x toggle-debug-on-error and try it again (--debug-init only breaks into debugger on startup). 2. Are you sure stack is in the path? Did you try running it from terminal? Commented Sep 8, 2016 at 20:02
  • 1
    See this github issue: github.com/haskell/haskell-mode/issues/1300 Commented Sep 8, 2016 at 20:08
  • @Yuri 1. Worked! I now get each time I change something the error: Company: An error occurred in auto-begin Symbol's function definition is void: haskell-completions-completion-at-point 2. It works in the terminal. However, I don't know how to verify if it's in the correct path Commented Sep 8, 2016 at 20:09
  • Check the link @elethan suggested. Commented Sep 8, 2016 at 20:18
  • 1
    Adding (add-to-list 'exec-path "/usr/local/bin/") to .emacs config file fixed the problem. Thanks @elethan Commented Sep 8, 2016 at 20:34

2 Answers 2

6

I've managed to fix the problem by adding

(add-to-list 'exec-path "/usr/local/bin/")

to the .emacs config file.

Sign up to request clarification or add additional context in comments.

Comments

2

I'd recommend the exec-path-from-shell library; I had similar issues on OS X and this solved them for me.

Once the library is installed, put the following in your .emacs:

(exec-path-from-shell-initialize)

If you ever run emacs from the shell, it may be worth inserting the following instead:

(when (memq window-system '(mac ns))
  (exec-path-from-shell-initialize))

Comments

Your Answer

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

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.