Greetings.

In a discussion on another list [1] the question arose of how, exactly, the 
settings in ~/.MacOSX/environment.plist get into the environments of processes 
started from the Finder.  That now seems reasonably clear, but I was surprised 
that it was so hard to find an explicit account of this process.  This list 
seems like the sort of place which would know.

So, for the archive, is the following completely correct?

  1. The loginwindow process reads environment.plist at login time, and injects 
its contents into the per-user launchd process using essentially the same 
mechanism as 'launchctl setenv'.  Note [2] says "For each of [the keys in 
environment.plist], loginwindow registers an environment variable of the same 
name and assigns it the value of the key" which is _almost_ this, but not quite.

  2. Since _every_ other application launched, either from the Finder, from 
Spotlight, from an application launcher, or from 'open foo.app' (which just 
uses the Finder) is opened as a child of this per-user launchd (thus inheriting 
its environment), this is how environment.plist gets to applications.

And... where is this written down?  I had some difficulty finding authoritative 
references, including searching this list's archive, and even those I found, 
including [2], don't seem to describe this process completely explicitly.  

Thanks for any pointers,

Norman
[who seems to have become slightly obsessive about this question]


[1] See eg http://email.esm.psu.edu/pipermail/macosx-emacs/2010-May/002110.html
[2] 
http://developer.apple.com/mac/library/documentation/MacOSX/Conceptual/BPRuntimeConfig/Articles/EnvironmentVars.html

-- 
Norman Gray  :  http://nxg.me.uk

_______________________________________________
MacOSX-admin mailing list
[email protected]
http://www.omnigroup.com/mailman/listinfo/macosx-admin

Reply via email to