[Openmcl-devel] Setting environment variables for GUI apps

Raffael Cavallaro raffaelcavallaro at mac.com
Mon Jan 12 06:34:55 UTC 2004


On Jan 11, 2004, at 4:16 PM, Gary Byers wrote:

> If Emacs.app is in /Applications, launching it from a Terminal
> (via "open /Applications/Emacs.app") will cause it to inherit
> its environment from the shell's, and this would cause its
> "exec-path" to contain all of the directories that the shell's
> PATH does.

This is true, but it is also possible, and I believe Gary alluded to 
this in his post, to set environment variables for all GUI apps a user 
launches under Mac OS X. In every user's home directory, there is an 
invisible directory named:
  .MacOSX
In that .MacOSX directory create (or add to, if it already exits) a 
.plist file named:
  .environment.plist
The easiest way to edit .plist files is with Property List Editor Which 
is in /Developer/Applications if you've installed the Developer Tools 
(or Xcode).

To add environment variables that will be in effect for any GUI app, 
such as the Carbon Version of Emacs, available at:
<http://mindlube.com/products/emacs/index.html>
add new children to the Root entry (or new siblings of existing child 
entries, same diff), one for each environment variable, and enter it's 
value on the right hand side.

For example, to use slime with sbcl, the environment variable SBCL_HOME 
must be set (it's the directory where the sbcl core file is). So, you'd 
make a new child named SBCL_CORE and set its value to /usr/lib/sbcl (if 
that's where you've installed sbcl).

To have a certain value of PATH in effect for all GUI apps, add (or 
modify if already existing) a child named PATH and set its value to:
.:/another/directory/I/want/to/add:/yet/another:/another/still
Note the .: at the beginning (dot colon) - this tells the system to add 
these entries to the existing default entries which are already in 
effect for all Mac OS X GUI apps. Note that the last entry does *not* 
need to have a colon after it.

N.B. - For any changes to take effect, you will have to log out and log 
back in. This one has bitten me many times. Dammed aggressive caching! 
(unfortunately, merely executing:
touch ~/.MacOSX  and/or
touch ~/.MacOSX/environment.plist
will not work. You really do need to log out and back in again).
  Does anybody know if there's a process that can be killed and 
restarted so that logging out can be avoided (probably the 
WindowServer, so you'd lose anyway - oh well).

raf

Raffael Cavallaro, Ph.D.
raffaelcavallaro at mac.com
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: text/enriched
Size: 2472 bytes
Desc: not available
URL: <http://lists.clozure.com/pipermail/openmcl-devel/attachments/20040112/66439647/attachment.bin>


More information about the Openmcl-devel mailing list