[texworks] Adding to typesetting path on MacOS

Duncan Murdoch murdoch.duncan at gmail.com
Mon Oct 28 09:01:35 CET 2024


Yes, that works.  A simpler command to run is

  open -a "TexWorks"

I believe it's also possible to set up a bash script that does this, and 
then put it on the desktop to run it by clicking on it.  I haven't 
explored these ideas too much, so I don't know if you can give it a TW 
icon and put it in the dock.

Duncan Murdoch

On 2024-10-28 3:21 a.m., Jérôme LAURENS wrote:
> Hi,
> 
> Instead of launching TeXworks by double clicking the icon, you can open 
> a terminal window and execute
> 
> /Applications/TeX/TeXworks.app/Contents/MacOS/TeXworks&
> 
> Then TeXworks will access any tool currently available in the terminal.
> I personnel use that with the minted package that needs access to python.
> 
> If necessary, you can change "/Applications/TeX" to fit your needs.
> The final & is optional, it means to run TeXworks in the background of 
> the terminal.
> does
> Jérôme LAURENS
> 
>> Le 27 oct. 2024 à 14:36, Duncan Murdoch <murdoch.duncan at gmail.com> a 
>> écrit :
>>
>> 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.