HowTo: Set an Environment Variable in Mac OS X - /etc/launchd.conf
Environment variables set in launchd
will be available to all programs on the system. However since $HOME/.launchd.conf
is not supported, this approach is used for global environment variables only.
HowTo: Set an Environment Variable in Mac OS X - $HOME/.MacOSX/environment.plist
Environment variables that are set in ~/.MacOSX/environment.plist
are available to all applications, not just the Terminal, however it can only set user specific environment variables.
HowTo: Set an Environment Variable in Mac OS X - Terminal Only
The process of setting environment variables in the Terminal will be familiar to those with experience with Linux or UNIX. It involves editing files in /etc
for global environment variables, and in your home directory for user specific environment variables.
HowTo: Set an Environment Variable in Mac OS X - Prerequisites
Here we will talk about some things you’ll need for setting environment variables in Mac OS X.
HowTo: Set an Environment Variable in Mac OS X
There are a number of ways of setting environment variables in Mac OS X. We will show the different approaches and talk about the advantages and disadvantages of each.
- With the Terminal Only approach, you can set system wide and user specific environment variables, however it can only be used in the Terminal.
- With
~/.MacOSX/environment.plist
all programs can use these environment variables, but can only set user specific environment variables, and a log out and back in is required. Not supported in Mac OS X 10.8 and later. - With
/etc/launchd.conf
all programs can use these environment variables, but can only set system wide environment variables, and a reboot is required. Not supported in Mac OS X 10.10 and later. - With launchd.plist, the same things can be accomplished as with
/etc/launchd.conf
but formatted in an XML document.
Parts of this series
- HowTo: Set an Environment Variable in Mac OS X
- HowTo: Set an Environment Variable in Mac OS X - Prerequisites
- HowTo: Set an Environment Variable in Mac OS X - Terminal Only
- HowTo: Set an Environment Variable in Mac OS X - $HOME/.MacOSX/environment.plist
- HowTo: Set an Environment Variable in Mac OS X - /etc/launchd.conf
- HowTo: Set an Environment Variable in Mac OS X - launchd.plist