Emacs doesn't respect $PATH on OSX #132

honza opened this Issue Jul 13, 2012 · 4 comments


None yet
3 participants

honza commented Jul 13, 2012

Yes, it's in the README but the suggested fix doesn't work.

(setenv "PATH" (shell-command-to-string "echo $PATH"))

I'm not really sure how I can help you debug it. Let me know what you need.

Evaluate (shell-command-to-string "echo $PATH") in the scratch buffer or via M-x eval-expression, then make sure it is the PATH you expect.

If you have lein under PATH and it works in the terminal, there should be no need to use setenv.

Another way to set up PATH is to Max customize-apropos PATH [ret]. Then find find exec path and Swank path there. However, in my case they do not include ~/bin, which is where lein is located. This has been the case for over 1 year, with 2 Emacs versions, several Leiningen versions and lein-swank plugin updates.

honza commented Jul 13, 2012

Evaluating in a scratch buffer gives the wrong $PATH. I fixed it by doing

(setenv "PATH" (shell-command-to-string "source ~/.bashrc; echo $PATH"))

@honza honza closed this Jul 13, 2012


technomancy commented Jul 13, 2012

.bashrc is not the right place to customize your $PATH, but if you got it working that's good. Settings that are shell-agnostic go in .profile instead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment