Emacs 24.5.1 on OS X 10.11.1.

This is the content of /etc/paths:


This is the value of exec-path:

 "/sbin" "/Applications/Emacs.app/Contents/MacOS/bin-x86_64-10_9" 

Why doesn't it contain /usr/local/bin?

3 Answers 3


OS X only evaluates /etc/paths and /etc/paths.d/ for shell sessions, through an invocation of path_helper in the global shell profile.

GUI applications have a different launch path (through launchd as far as I know), which includes a different environment and a different environment configuration. Specifically, GUI applications do not inherit $PATH from a shell session, and thus do not get $PATH entries from the aforementioned files.

You can work around this behaviour with exec-path-from-shell, which sets exec-path based on the $PATH value of a shell session. This package is more or less a standard equipment for Emacs users on OS X.

  • My memory is wrong. I know $PATH is only for shell but thought etc/paths is for all.
    – an0
    Commented Nov 12, 2015 at 13:34

For future searchers: I used this to solve the problem:


It is a small elisp module that mimics the behavior of the /usr/libexec/path_helper utility available on MacOS.

I added these lines to my .emacs

;; set path correctly on MacOS, based on /etc/paths
(if (memq window-system '(ns mac))
  (path-helper-setenv "PATH"))

For more information you may want to examine this link on emacswiki.


Emacs initializes ‘exec-path’ when it starts up, based on the value of the environment variable ‘PATH’.

C-hig (elisp) Subprocess Creation RET

  • I think the OP's question is rather, why the contents of this file do not end up in $PATH for an Emacs session, like they do for a shell session.
    – user227
    Commented Nov 12, 2015 at 8:34
  • No doubt you're right. This answer would at least have enabled them to realise what the real question actually was, though. I would suggest to whoever cast the down-vote that voting down an answer which does answer the stated question is perhaps a little bit harsh.
    – phils
    Commented Nov 12, 2015 at 9:25
  • I cast the down vote because I think that this does not answer the question at all. It's entirely unrelated to the actual issue. Besides, in my opinion just quoting the manual with no context is not a proper answer.
    – user227
    Commented Nov 12, 2015 at 9:47
  • They appeared to be confused about where the contents of exec-path came from, and believed that their /etc/paths file had something to do with it. I quoted the manual to show that this file has nothing to do with exec-path (and they would have then been able to easily confirm that Emacs does indeed use the value of PATH). I'm unsure as to what additional context I could have usefully provided. (I could have stated explicitly that the quote therefore meant that the value did not come from /etc/paths, but that would have seemed a bit redundant.)
    – phils
    Commented Nov 12, 2015 at 10:12

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.