Setting Environment Variables in Mac Os X
Once you have experience (or not) with some uX system, at some point you have to deal with environment variables, especially if you intend to do some development. I used to come from Open Source uX systems, and some old ones like HPUX, AIX, Solaris. When I switched to OS X, which is to some extent BSD - I had to find the best way to deal with env. variables. So - here are the ones that I use
Variables set in your terminal access
Say you are using some variables usually in terminal access. Then you can use the same way of setting them, as on any other uX System - in your shell profile scripts (the one that is executed at the beginning, when you start terminal). In my case I use bash
- so the file that I use to set env variables is
$HOME/.bash_profile
You can simple add lines to this file (or create it, if it does not exist):
export TOMCAT_HOME=/opt/apache-tomcat
Setting environment variables that should be available also in programs outside terminal - say you want to have them in Eclipse IDE, or in some other program - then we do it in
/etc/launchd.conf
the syntax there is different:
setenv ANDROID_HOME /opt/android-sdks
this will require root access and restarting the launchd or system, in order to have them active.
~Enjoy