Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I use emacs on my mac, I install the Cocoa version of emacs using homebrew. One problem is that in order to see the "Unix path" I had to replicate my path from .profile to .MacOSX/environment.plist

I do it with this in my .profile:

# PATH for emacs and cocoa apps
/etc/profile begin
if [ -x /usr/libexec/path_helper ]; then
  eval `/usr/libexec/path_helper -s`
  defaults write $HOME/.MacOSX/environment PATH "$PATH"
fi

And that used to work, but it stopped working when I installed Mountain Lion. I can't find any manual that says that they've changed it on this version.

Does anyone know how to see the unix path from cocoa applications on Mountain Lion?

share|improve this question
1  
Hm, IIRC they planned on deprecating environment.plist a long time ago. You can try to use /etc/launchd.conf or launchctl setenv instead, but your mileage may vary. I'll check this out tomorrow. – slhck Aug 6 '12 at 21:22
    
oh thank you! Apparently the .MacOSX/environment file has been deprecated (it'd be nice if Apple had a nice article explaining the situation and what to do instead). I replaced the code in the .profile with launchctl setenv PATH $PATH and it works, but I need to reboot to any changes on the path. – FCo Aug 7 '12 at 21:44

To formally answer this question: It could be that .MacOSX/environment.plist does not work anymore (?) or at least not reliably. It never worked for apps launched by Spotlight. It is documented though: Runtime Configuration Guidelines: Environment Variables

The alternative to that is using launchctl, which will make environment variables accessible to GUI apps. For example, this copies your shell's PATH to the environment:

launchctl setenv PATH $PATH

For any changes to $PATH, you will have to restart the affected apps. You do not need to reboot if you use above syntax. If, however, you change /etc/launchd.conf, you will need to reboot. See also: Setting environment variables in OS X? - Stack Overflow

share|improve this answer
    
It does not really work! I don't get. It sometimes it does and sometimes it doesn't. launchctl getenv PATH from an emacs shell returns the right thing, but echo $PATH has the wrong path in it!. For the moment I do (setenv "PATH" (shell-command-to-string "launchctl getenv PATH"))' at the beginning of the .emacs` file, but it is a hack! – FCo Aug 9 '12 at 18:43
    
Hm. I have never used the Cocoa emacs, and for me the .MacOSX version has always worked, at least until 10.6 (and I haven't needed it afterwards). Maybe you can update your question with your current status – especially with emacs – and others can have a look? – slhck Aug 9 '12 at 18:54

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .