I'm using the latest version of emacs, with and without a custom MacOS build (homebrew-emacs-plus). So, I'm trying to use spacemacs on MacOS, and I can't get it to pick up the $PATH on my host system. So when I try to run a command like M-x magit-status, I get the error message.

apply: Searching for program: No such file or directory, git

Spacemacs is using Steve Purcell's exec-path-from-shell. This SO question isn't quite solving it. And I've tried the below configuration (not using exec-path-from-shell), but no dice. I can get it working on my custom emacs configuration. But I’m trying to transition to spacemacs. And this is a blocker. Anyone know howto solve this?

(let ((path (shell-command-to-string ". ~/.bash_profile; echo -n $PATH")))
  (setenv "PATH" path)
  (setq exec-path 
         (split-string-and-unquote path ":")

2 Answers 2


Ok, solved this one. It turns out that there was an export PATH in my .bashrc (as well as .bash-profile). exec-path-from-shell doesn't like this, and only wants that export to happen in .bash-profile. This warning message gives a hint of the expectation. But I didn't realize that the package doesn't work if the condition isn't satisfied.


Warning (emacs): You appear to be setting environment variables ("PATH") in your .bashrc or .zshrc: those files are only read by interactive shells, so you should instead set environment variables in startup files like .bash_profile or .zshenv. Refer to your shell's man page for more info.


I have no experience with Spacemacs, but if it's just magit you need to get working right now, you may want to try setting magit-git-executable to the full path (e.g., '/usr/local/bin/git' instead of 'git') as a workaround to getting your path set correctly.

  • Hey @willy-lee. I actually already have this working for my own hand-rolled emacs config. I'm trying to get the equivalent exec-path-from-shell (which is what spacemacs uses) functionality working. I tried this on both GNU Emacs 24.5.1 and 25.1.1, and running into this blocker for both versions. Feb 7, 2017 at 5:51

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.