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 appliations) 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:
environment.plist, you must log out and then log back in again to see the changes.
~ is not expanded.
environment.plist and in .cshrc (or any other config file that is read when Terminal starts up). The definition in .cshrc will override (i.e. supersede, shadow, replace) the definition in environment.plist when using the Terminal. This often bites people defining PATH.
Notes:
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
@ . .