[OS X Emacs] Re: Environment variables and Aquamacs 2.0

Jan Dubois jand at activestate.com
Thu May 27 21:19:49 EDT 2010


On Thu, 27 May 2010, Norman Gray wrote:
> On 2010 May 27, at 00:11, Jan Dubois wrote:
> > On Wed, 26 May 2010, Norman Gray wrote:
> >> On 2010 May 26, at 22:01, Jan Dubois wrote:
> >>
> >>> There is actually at least one more scenario: Aquamacs being started
> >>> from Spotlight. In which case you get neither environment.plist nor
> >>> shell environment variables because the process starts out as a
> >>> child of Spotlight, which is not running under the current user.
> >>
> >>
> >> I don't believe this would be a separate scenario.
> >
> > No need for "believe", you can actually try it.
> 
> I did try it, and a Terminal started from Spotlight inherits launchd's
> environment, and launchd's initial environment is (usually? always?)
> governed by environment.plist.

No, the launchd environment is separate from ~/.MacOSX/environment.plist.

It also looks like environment.plist is read only once and cached.  Any
changes are only effective once I log out and back in (on both 10.5 and
10.6).

> For example, try
> 
> % launchctl setenv LAUNCHD_ENVIRONMENT_TEST foo
> 
> Then quit Terminal, restart it using Spotlight, and
> 
> % echo $LAUNCHD_ENVIRONMENT_TEST
> foo
> %

This does indeed work, even on 10.5.

Further testing shows that on 10.6 processes launched by Spotlight will now
get the ~/.MacOSX/environment.plist settings as well, whereas on 10.5 they
don't.  So I guess this is just a problem that has since been fixed by Apple.

Sorry for the confusion; I should have double-checked on both 10.5 and 10.6
first.

Cheers,
-Jan





More information about the MacOSX-Emacs mailing list