Set PATH from GUI app [was Re: [OS X TeX] pdf font coding problems]

Kevin Walzer sw at wordtech-software.com
Thu Dec 22 19:12:48 CET 2005


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Bruno Voisin wrote:
> Le 22 déc. 05 à 17:04, Jens Nöckel a écrit :
> 
>> thanks for the info - I'll add this to my instructions, for those who
>> use i-installer. I've got various other OSX applications that call
>> scripts, and to get them all on the same page the plist mechanism has
>> worked perfectly well for me. And as I say, it's customizable. I
>> customized it so that fink will come first, because I don't use
>> i-installer.
> 
> Re-reading what I had written, I realized things may not be as simple as
> I had thought: it's not necessarily true that a GUI application, such as
> your Platypus script, will by default be able to launch Unix binaries
> that are in the path of a login shell, such as that provided by Terminal.
> 
> This problem has arisen several times, in particular for Enhanced Carbon
> Emacs and for LyX/Mac. The technical details are beyond my
> understanding: I remember Gerben telling that it is up to the GUI
> application to set up an environment providing the correct path for the
> Unix binaries that it may be calling, and citing TeXShop as an example,
> but I don't remember the exact solution. Given that LyX/Mac is no longer
> using the ~/.MacOSX/environment.plist route, they have probably found a
> solution. I'm a bit too short of time today to do more resarch on this
> (being on holiday this evening, still with several things to do, and not
> back until 9 January).
> 
> Wait: in a earlier message to this list, here's what Gerben said on this
> topic:
> 
>> De : Gerben Wierda
>> Date : 31 mai 2005 23:55:20 HAEC
>> À : TeX on Mac OS X Mailing List
>> Objet : Rép : [OS X TeX] epstopdf can't find Ghostscript
>> Répondre à : TeX on Mac OS X Mailing List
>>
>> On May 31, 2005, at 23:25, Peter Dyballa wrote:
>>
>>> Am 31.05.2005 um 22:50 schrieb Gerben Wierda:
>>>
>>>> The environment.plist file is a leftover from NEXTSTEP and because
>>>> it influences all apps it may have unwanted and unexpected effects
>>>> (in fact it can break i-Installer if the contents are broken)
>>>
>>> Can you be a bit more specific on this? Which settings have this
>>> impact? PATH only?
>>
>> PATH is an important one for any tool that uses subprocesses. Muck
>> around with it and suddenly apps may get different versions or none at
>> all. I have had my share of help requests for i-installer doing funny
>> things as a result of this.
>>
>>>> The correct way is to have the GUI *application* (and not a global
>>>> setting for all GUI applications) set the right PATH before
>>>> executing commands.
>>>
>>> You mean that at login-time the correct values for PATH or path
>>> should be set? And this should work because any process created by a
>>> GUI app should have then too the right settings?
>>
>> No, what I mean is that if a GUI app requires non-default setting for
>> its working (and that generally means running subprocesses) it should
>> keep its own PATH setting. TeXShop does this in its Preferences (in
>> the Engine tab).
>>
>> The Apple Frameworks for running subprocesses have the possibility to
>> pass environment variables to that subprocess. Hence, TeXShop passes
>> an updated environment to the subprocess including a PATH containing 
>> and /usr/local/bin and
>> /usr/local/teTeX/bin/powerpc-apple-darwin-current (or whatever you set
>> in preferences)
>>
>> It is OK to have some sort of a default. It is not OK that
>> i-Installer's PATH changes because some other Foo.app needs a
>> different path.
>>
>> I am probably giving up on this. If I produce a next version of
>> i-Installer it will completely set its own environmen, just to be
>> protected against stuff coming from environmen.plist
>>
>> G
> 
> Again that's a bit too technical for me, but I hope it makes more sense
> to a programmer.
> 
> Bruno Voisin------------------------- Info --------------------------
> Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
>          & FAQ: http://latex.yauh.de/faq/
> TeX FAQ: http://www.tex.ac.uk/faq
> List Archive: http://tug.org/pipermail/macostex-archives/
> 
> 
> 

One way to set a path from a GUI application (if you are the developer)
is to explicitly do so inside your own code.

For instance, AquaEthereal (a little app launcher for Ethereal that I've
developed) includes this in its code:

PATH=/opt/local/bin:/sw/bin:$PATH; export PATH

This adds /opt/local/bin and /sw/bin to the path searched by the
application, since ethereal is usually installed in one of those two
places.  The default path (I believe) from the GUI level is only /bin
and /usr/bin.

Hope this helps someone.

- --
Cheers,

Kevin Walzer, PhD
WordTech Software - "Tame the Terminal"
http://www.wordtech-software.com
sw at wordtech-software.com
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (Darwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org

iD8DBQFDquygJmdQs+6YVcoRAmP5AJwJn7j+/L8cRuSaSh/ZO0VaUfgU+QCggvNS
ZlEJ4AmD375w+5voaLMI2wA=
=wFNE
-----END PGP SIGNATURE-----
------------------------- Info --------------------------
Mac-TeX Website: http://www.esm.psu.edu/mac-tex/
          & FAQ: http://latex.yauh.de/faq/
TeX FAQ: http://www.tex.ac.uk/faq
List Archive: http://tug.org/pipermail/macostex-archives/




More information about the macostex-archives mailing list