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).

The trick is to define your environment variables in the file ~/.MacOSX/environment.plist. You will almost certainly have to create the directory and the file yourself. The format is as per this example:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
	<key>DISPLAY</key>
	<string>:0.0</string>
	<key>PYTHONPATH</key>
	<string>/full/path/ofyour/favorite/script/dir:/full/path/of/another/script/dir:</string>
</dict>
</plist>

Warnings:

Notes:

Acknowledgements

Thanks to the tech support people at Bare Bones Software for first telling me about this file and to "ka" for the information about the conflict between variables defined both in .cshrc and environment.plist.

Last updated 2004-04-22

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