Setting Environment Variables for Mac OS X Programs

by Dana H. P'Simer

Fri, Feb 9, 2007

For the most part, Mac OS X programs do not use environment variables or the PATH. They behave in a very different way from other Unix environments on this score. However, as Java developer I use several tools that require that other command line programs be available on the system PATH. In Windows and Unix there are well known places to put this kind of information but in Mac OS X the location for these changes is obscure.

Adding the variables to the /etc/profile, /etc/bashrc, ~/.profile, or ~/.bashrc files does not accomplish the task since these files are not used to setup the environment of the WindowServer process, the parent of all Mac OS X programs. I did, eventually, find some information on the subject.

There are these articles: Environment Variables, QA1255 and QA1068.

These articles were really hard for me to find, I think, because they were written mostly for folks wanting to port Unix applications to Mac OS X. In my case, I am attempting to use Java applications like Eclipse and Netbeans. Specifically, they needed the subversion commands on the path and they were installed into /usr/local/bin instead of /usr/bin. A good policy but not on the default PATH variable.

NOTE: I forgot to mention, you have to logout for these changes to have any effect.