env_vars 

Send to Kindle
home » snippets » os_x » env_vars



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