1

For example, when I launch Emacs from the terminal (an interactive shell), I can use "M-x shell".

When I launch Emacs from the dock (which spawns process from some other shell), I cannot, because "grep isn't found" (or 'ls' or 'some other universal UNIX command'). Also, half my non-default applications have stopped working (MATLAB, DrRacket, X11, etc).

  1. How do I change the environment of the shell that is called by the dock?
  2. What shell does the dock call / what else ought I know about different shells on a mac?
1

You should create the file ~/.MacOSX/environment.plist with inside

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>PATH</key>
<string>/Users/gio/.dotfiles/bin:/usr/local/bin:/usr/bin/:/usr/sbin/:/bin:/sbin</string>
<key>PYTHONPATH</key>
<string>/Users/gio/.local:/Users/gio/.local/lib/python2.7/site-packages</string>
</dict>
</plist>

What I wrote above is just an example, but I think you get the main point here. After you create the file, log out, log in, and you should be all set. You could have a ruby path as well, etc.

  • thanks! what does each component of "<!DOCTYPE ... > do? that is: plist, PUBLIC, "-//Apple//..." and "apple.com..." – Francis Haart Nov 2 '11 at 4:01
  • also, "2. What shell does the dock call / what else ought I know about different shells on a mac?" – Francis Haart Nov 2 '11 at 4:14
  • The first three lines are meant to identify plist. As for the different shells: every program not called from the terminal, use the environment variables specified above. Every program called from the terminal, use the variables specified in .bashrc/.profile/.zshrc etc. – Gio Nov 2 '11 at 16:10

You must log in to answer this question.

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