How to set Mac OS X Global Environment Variables

I have recently switched to MacBook Air and started exploring the fantastic Mac OS X - a pleasant OS on a pleasant piece of hardware.

This week I’m trying out setting up a LISP environment with Clozure CL and Emacs/SLIME. I’m using the Emacs for Mac OS and SLIME. I needs tell a LISP script about where to find the LISP installation with the environment variable CCL_DEFAULT_DIRECTORY. It’s rather easy to do this for consoles - but how to do it with, the cocoa-version?

There has been some searching on Google and it turns out the following works perfect: edit /etc/launchd.conf to contain a line like this:

setenv M2_HOME /opt/maven/2.0.9

Note that one can also do this with ~/.launchd.conf, which only affects the user only. The per user .launchd.conf does not seem working - I lost the configuration once I restarted

It’s also possible to take the changes into effect without rebooting or even logging out by

grep ^setenv ~/.launchd.conf | launchctl

via Mac OS X Global Environment Variables | Digital Edge Software and Consulting.

Contents on this site are licensed under a Creative Commons Attribution-ShareAlike 4.0 International License. Creative Commons License