Setting global environment variables on OS X

Applications (like RV) can make use of environment variables in various ways. It is a bit of a mystery for many Mac users how to create environment variables that will be available for all applications, including those launched from icons, etc. If you are using Windows, please see Setting Global Environment Variables on Windows.

The process involves creating (or editing, if it exists) a special environment.plist file in the users home directory. You can add the environment variable and it's value here. Then you have to log out and in.

Create the plist file under ~/Library/LaunchAgents/:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "">
<plist version="1.0">
<string>launchctl setenv RV_OS_PATH_OSX /volumes/zdisk; launchctl setenv RV_OS_PATH_WINDOWS Z:;</string>


To activate the environment.plist (assuming you named it environment.plist), run

launchctl load ~/Library/LaunchAgents/environment.plist
launchctl start ~/Library/LaunchAgents/environment.plist

If it is already loaded and you have modified the plist file, see your updates by running:

launchctl stop ~/Library/LaunchAgents/environment.plist
launchctl unload ~/Library/LaunchAgents/environment.plist
launchctl load ~/Library/LaunchAgents/environment.plist
launchctl start ~/Library/LaunchAgents/environment.plist

For further reference, see this StackExchange article which talks about setting environment variables in previous versions of OS X up through 10.10 (which still works as of 10.12 Sierra).