[texworks] Adding to typesetting path on MacOS

Duncan Murdoch murdoch.duncan at gmail.com
Sun Oct 27 14:36:28 CET 2024


On 2024-10-27 9:14 a.m., Duncan Murdoch wrote:
> On 2024-10-27 8:46 a.m., Joseph Wright wrote:
>> On 27/10/2024 12:42, Duncan Murdoch wrote:
>>> On 2024-10-27 6:03 a.m., Duncan Murdoch wrote:
>>>> For one of the typesetting tools I'm using, I need access to ghostscript
>>>> for graphics file format conversion.  My copy of gs is in /opt/
>>>> homebrew/bin.
>>>>
>>>> I am having trouble adding /opt/homebrew/bin to the typesetting path,
>>>> because the preferences dialog opens a file dialog for changes, and /opt
>>>> isn't showing up.  If I open / in the Finder, it shows opt as a grayed
>>>> out entry, presumably indicating some sort of hidden attribute, but I
>>>> don't see it at all in the TeXWorks dialog.
>>>>
>>>> Any suggestions how to add it to the typesetting path?  I suuppose Iis a
>>>> could link to gs from an existing directory in the path, but I'd prefer
>>>> a cleaner solution.
>>>
>>> I found a solution to this:  if I open / in the TeXworks dialog, and
>>> also in a Finder window, I can drag /opt from Finder to the TeXworks
>>> dialog and it will open.  Then I can add my /opt/homebrew/bin entry.
>>>
>>> HOWEVER, this doesn't help.  gs is still not being found.  If my
>>> typesetting tool prints the PATH that it sees, it shows a minimal path:
>>>
>>>      /usr/bin:/bin:/usr/sbin:/usr/local/bin
>>>
>>> If I start TeXworks from a shell, then it sees the full path that was
>>> active in the shell, and things are fine.
>>>
>>> So now my question is:  how do I change the PATH environment variable
>>> that typesetting tools see?
>>>
>>> Duncan Murdoch
>>
>> You can't - as TeXworks is cross-platform, it doesn't have a special
>> feature to address the way macOS deals with the path for GUIs
>> (basically, they don't get one), cf. macOS-specific tools like TeXshop.
>>
>> You have to arrange that whatever tools you need are visible inside the
>> 'correct' paths - here, MacTeX should have arranged that GhostScript is
>> inside /usr/local/bin, so I'm wondering why you are trying to use one
>> from HoneBrew.
> 
> I'm not using MacTeX, I'm using a different minimal install of TeXLive.
> 
> But this isn't really a MacOS specific issue.  I think often the
> typesetting tools would want a different PATH than the system PATH.  I
> thought that was what the "Paths for TeX and related programs" section
> of the TeXworks preferences was for.  So what does it actually do?

Okay, I see now.  Every typesetting command runs a single executable, 
not a script.  TW uses the "Paths" setting to find that executable, it 
doesn't set the PATH to find it.

So I guess a suggestion would be to do both things:  set the path as 
requested, then run the executable.

Duncan Murdoch



More information about the texworks mailing list.