Please no: [OS X TeX] set environment variables for applications

Gerben Wierda Gerben.Wierda at rna.nl
Mon May 24 20:43:42 CEST 2004


On May 24, 2004, at 17:31, Kino wrote:

> On May 24, 2004, at 22:15, Gerben Wierda wrote:
>
>>> it's possible to set environment variables for all processes 
>>> launched by a specific user (including those launched via Finder), 
>>> as described in
>>> http://developer.apple.com/qa/qa2001/qa1067.html
>>
>> Please, can somebody else than me kill this suggestion ASAP? If you 
>> start to set variables for all applications there, the variables also 
>> go to apps like i-Installer and not all scripts inside i-Packages are 
>> robust for an unlimited amount of environment variable settings.
>
> But this is a well known method since longtime. IIRC I created my 
> environment.plist when I compiled perl 5.6.1 on OS X 10.1.x following 
> the instructions available as
> <http://duke.usask.ca/~dalglb/macosx/Perl_5.6.html>
>
> However I may misunderstand what you say as I'm not a user of 
> i-Packages. But...
>
>>> To sum it up, create a file named ~/.MacOSX/environment.plist (if it 
>>> does not yet exist) that looks like
>>
>> Applications shoul dmanage their own environment. Changing it for all 
>> applications because an application does not support its own set of 
>> preferences is a remedy which may be more dangerous than the cause.
>
> What do you mean by *applications*? If that's Aqua apps, you would 
> confuse user defaults -- mostly set from Preferences GUI -- with 
> variables defined by environment.plist. I use it, for example, to set 
> $PATH for shell commands executed via TextExtras or from within Aqua 
> applications such as TeXShop and Xcode. If I'm not mistaken, this 
> works also with BBEdit that I don't have.

In my view, if an app requires a special environment setting (this only 
makes sense if it has subprocesses that use the environment, such as 
i-Installer, emacs frontends, TeXShop, iTeXMac, etc) it should keep its 
own list of environment settings and apply these to the environment 
when it has started up. It should store these environment variables in 
its defaults.

The only exception for historical reasons are command line applications 
(mostly unix). These do not use the defaults system so the only thing 
they have are the global environment settings from /etc/profile and the 
like.

The TeX i-Package gives you the choice to set the PATH environment for 
command line use of the tex programs. It is not required to set this. 
If you only use a front end like TeXshop, it stores its setting for the 
location of TeX in its defaults. Then it applies these before 
subprocesses are run. Works like a charm and there is no need to set 
anything global.

Remember, *global* variables are fine for *global* purposes. For 
command line programs which we start from the shell, we do not have the 
alternative. But for GUI apps, we generally have. We can set variables 
per app, and thatis what we should do. Changing environment.plist is 
just a lazy solution. It changes settings for all GUI apps, not just 
the app you intend it for,

G

-----------------------------------------------------
Please see <http://www.esm.psu.edu/mac-tex/> for list
guidelines, information, and LaTeX/TeX resources.





More information about the macostex-archives mailing list