This includes any shells already running under Terminal.app, although if you're there you can set the environment more directly, e.g. There's no need to reboot though you will need to restart an app if you want it to pick up the changed environment. bashrc or similar, then have it mirrored in launchd: PATH=/opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin For example to set the path: launchctl setenv PATH /opt/local/bin:/opt/local/sbin:/usr/bin:/bin:/usr/sbin:/sbin You can set the environment used by launchd (and, by extension, anything started from Spotlight) with launchctl setenv. How to set the environment for new processes started by Spotlight (without needing to reboot) While it was documented that $HOME/.nf would be consulted prior to setting up a user's session, this functionality was never implemented. The /etc/nf file is no longer consulted for subcommands to run during early boot time this functionality was removed for security considerations. Launchctl no longer has an interactive mode, nor does it accept commands from stdin. The man page for launchctl says that it never worked: These will also be available in IntelliJ IDEA and other GUI applications you launch via Spotlight. Prove that your variables are working by opening a Terminal window and typing export and you should see your new variables.
#Osx $path code#
Or use the grep/ xargs command which is shown in the code comment above. Save your changes in vi and reboot your Mac. Setenv JMETER_HOME /Applications/Dev/jakarta-jmeter Setenv M2_HOME /Applications/Dev/apache-maven Setenv MAVEN_OPTS "-Xmx1024M -XX:MaxPermSize=512m" Setenv ANT_HOME /Applications/Dev/apache-ant Setenv JRUBY_HOME /Applications/Dev/jruby Setenv NEXUS_HOME /Applications/Dev/nexus/nexus-webapp Setenv GRAILS_HOME /Applications/Dev/grails Setenv GROOVY_HOME /Applications/Dev/groovy Setenv JAVA_HOME /System/Library/Frameworks/amework/Versions/1.6/Home # You also need to surround multiple values in quotes, see MAVEN_OPTS example below. # Note that you must hardcode the paths below, don't use environment variables. # grep -E "^setenv" /etc/nf | xargs -t -L 1 launchctl # NOTE: You will still need to restart the relevant application (including # environment variables globally without needing to reboot.
#Osx $path update#
# After editing this file run the following command from the terminal to update # (and Terminal), including those launched via Spotlight. Put contents like the following into the file # Set environment variables here so they are available globally to all apps Type sudo vi /etc/nf (note: this file might not yet exist) Please note that ist does not work for applications launched via Spotlight. I've done extensive research and if you want to set variables that are available in all GUI applications, your only option is /etc/nf.