Environment Variables in OSX Mavericks

In OSX Lion and previous versions, you used to be able to define your environment variables within the


file. However this has changed in OSX Mavericks, as least for windowed applications to the following file


However you may find that this file doesn’t already exist. You can then edit the file using your favourite editor, for example to use vi

sudo vi /etc/launchd.conf

Then add your environment variables, for example setting some Apache Maven

setenv MAVEN_OPTS "-Xmx512M" -XX:MaxPermSize=512M"
setenv M2_HOME /Library/apache-maven-3.1.1

and restart your windowed applications.

These setting will only take place after a reboot. If you want to avoid a reboot then you can set the properties that are launchctl command

launchctl setenv M2_HOME /Library/apache-maven-3.1.1

You will still need to restart your application. The variables set with launchctl do not survive a reboot, therefore you will need to make your changes to the launched.conf file to ensure they survive a reboot.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.