Links
- SO: Setting environment variables in OS X?
- TL;DR – edit/create
/etc/launchd.conf
and set them likesetenv JAVA_VERSION 1.6
environment.plist
isn't enough – ref Mac OS X Global Environment Variables
- TL;DR – edit/create
Setting path
If you can't / don't want to edit /etc/launchd.conf
(since
that affects all users in the system), you can get/set the
PATH
this way. (It only affects the current user and
you have to do it on every boot.)
# What PATH does launchctl have? launchctl getenv PATH # Set the path for launchctl. launchctl setenv PATH $PATH # Show all the environment vars from launchctl launchctl export # IMPORTANT: The changes only affect newly launched apps. # To fix apps launched from the Finder or the Dock, you should killall SystemUIServer # For apps launched from Spotlight search bar killall Dock # For apps launcher from the Dock killall Finder # For apps launcher from Finder