Setting OS X PATH variable

On MacOS X, I want both shell and Aqua applications to have the same view on installed and preferred applications.

However, unlike on other Unixoid systems, OS X runs no user login shell which reads my ~/.profile settings on startup. The mechanism was replaced by the ~/.MacOSX/environment.plist property list, which provides an initial environment at login. Unhelpfully, it is also read at login time only, i.e., after changing it a user has to logout and login again to actually see the changes taking effect.

Property lists are used in several other places, and helpfully, OS X comes with a property list editor (Property List Editor.app): Screenshot: PropertyListEditor.app

Nevertheless, it is possible to keep settings in one place by reading out the environment file from the shell profile:

export PATH=$(defaults read ~/.MacOSX/environment PATH)

Depending on the default shell used, the code goes into ~/.zshenv (zsh) or ~/.profile (sh-likes), etc.

The above screenshot shows other useful settings, like CVS_RSH, locale settings, etc.

comments powered by Disqus