Please no: [OS X TeX] set environment variables forapplications

Enrico Franconi franconi at inf.unibz.it
Tue May 25 17:30:39 EDT 2004


On 25 May 2004, at 22:29, Gerben Wierda wrote:
>> Even if it were possible to set it per application, I would prefer 
>> setting $PATH for them generally. Otherwise, it would be difficult to 
>> keep the consistency.
>
> Yes. But suppose you add /sw/bin to the start of your PATH and as a 
> result a different version of a command is used and your application 
> which uses a subprocess that now suddenly fails. And how do you know 
> why?

(This is a bad example. Either you do have fink (and therefore the 
/sw/bin path), and then this is what it should be done to let it work 
properly, or you do not have fink, and then there is no effect 
whatsoever. But this is not the real point.)

The PATH variable (like ANY environment variable) is a global setting, 
that all applications use, but the GUI applications launched with a 
double click or more generally launched not from a shell. In fact, try 
to launch your favourite GUI application from the command line with a 
"open -a APPNAME", et voila', the GUI application inherits ALL the 
shell variables, including the PATH variable. You can also write a 
simple applescript (I did it for the first releases of mac-emacs, which 
did not need any environment.plist to work properly) that wraps the 
launch of a GUI app with a double click within a shell invocation, so 
that the GUI app inherits for free all the shell environemnt variables. 
So, your insisting that "unix" applications are different from GUI apps 
for historical reasons and therefore they are allowed to use global 
environment variables (unlike GUI apps) is simply wrong. On the mac 
(like on KDE or Gnome), all applications (including GUI applications) 
are unix applications. In any GUI environment in the unix world 
(including the mac), the effect of launching an application not from a 
shell is the same: variables peculiar to the execution of the shell are 
not inherited, simply because the shell is NOT executed before the GUI 
app; you have to execute it explicitly if you want the environment to 
be inherited.

Of course, people may harm applications also from the command line by 
changing the PATH global variable or any other environment variable. 
Since this global mechanism exists, it has to be used with caution in 
any case. But the GUI apps do not make any difference in this respect. 
So, please, allow people to use the environment.plist provided as an 
option by some developer, exactly like we allow you to optionally hack 
the main environment variables.

cheers
--e.

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





More information about the MacOSX-TeX mailing list