How to define environment variables so that MacOS X applications can see them.

MacOS X native applications do not see unix environment variables defined in ~/.cshrc or any other of the standard unix configuration files. Normally this doesn't matter, but certain MacOS X applications can make good use of environment variables. These include the framework build of Python (which is used to write wxPython or aqua Tk applications) and BBEdit (which can directly run unix scripts, but without your environment variables unless you define them in this fashion).

In the old days you could create a file ~/.MacOSX/environment.plist and put them there, as per Apple's obsolete technical note QA1067.

The current procedure, as per this Digital Edge blog posting, is to add such environment variables to /etc/launchd.conf (creating the file if necessary) using the tcsh format (even if you use bash as your regular shell):

setenv varname varvalue

Reboot (required under MacOS 10.5 - 10.8 but reportedly not 10.9). Logging out and back in again is not sufficient.

The environment variables will then be visible to all applications and your Terminal sessions. (If you are running 10.9 and didn't reboot, then the new environment variables will only be visibly to newly launched applications and newly opened Terminal sessions.)

Last updated 2013-11-05

Russell Owen
University of Washington
PO Box 351580
Seattle, WA 98195-1580
rowen uw edu
     @  .