- Terminal apps in OS X (Terminal, iTerm, etc.) process terminals as login shells, so these variables should be set in the
~/.bash_profileand not the~/.bashrcfile.
- Create a
~/Library/LaunchAgents/environment.variables.plistfile to have launchd run a script at login that will set environment variables - Create a
/usr/local/bin/set-environment-variables.shscript (or wherever configured in the*.plistfile) and "export" the environment variables here (bash syntax like "export JAVA_HOME ..." doesn't work here) - Register the *.plist file with launchd
launchctl load -w ~/Library/LaunchAgents/environment.variables.plist
- Note the
environment.variables.plistfilename, theenvironment.variableslabel in the*.plistfile match