Under 10.8 which file stores the environment variables?

The system-wide default path is in /etc/paths. The default on a 10.8 system contains the following:

/usr/bin

/bin

/usr/sbin

/sbin

/usr/local/bin

To add additional system-wide PATH entries, you could change that file, but a better option would be to add a file with the additional path entries to directory /etc/paths.d. That user-created file will be protected during any upgrades/patches, which may replace a customised /etc/paths with an Apple-distributed version.

Alternatively, you could put the appropriate PATH modifying statements in /etc/profile or /etc/bashrc (in the case of bash, it will only use the latter if the former doesn't exist). Any other system-wide environment changes can be done using those files as well.

User-specific configuration can be put in $HOME/.bashrc or $HOME/.bash_profile.

Note: In the above, I've assumed you're using bash - if you're using csh or zsh, you'll need to adjust their configuration files (the information about /etc/paths and /etc/paths.d remains valid, however).


You could make your own .profile or .bashrc file to set environment variables for your user.