Setting environment variables Mac 10.6 [duplicate]

Solution 1:

Aside from the standard *nix ways of exporting variables (see JRobert's answer) there is a Mac specific way, which might be helpful, especially if you want GUI programs to pick up the environment variables.

First install the Developer Tools (on your OS X DVDs). Then in Terminal:

open ~/.MacOSX/environment.plist

The file should just have an example key:value pair for PATH. Then just click on "Add Child" and make your changes. You might have to log out and back in again, I'm not certain if the file gets reloaded on the fly.

The benefit of the environment.plist is that it's available to the entire OS, rather than just command line programs.

Solution 2:

An example:

export PATH=/opt/local/bin:$PATH