[texworks] LaTeXmk issue with Mac OS X Yosemite (new OS)

Guillaume Cabanac guillaume.cabanac at univ-tlse3.fr
Tue Oct 21 11:23:26 CEST 2014


Hi Stefan,

> Interesting. This suggests that Tw does not know about the "real" $PATH
> (otherwise it should find latexmk in $PATH). But at the same time,
> QProcess::setEnvironment() doesn't seem to work, either, as Tw should
> append the paths listed in the preferences to $PATH before calling a
> typesetting tool, and as you showed with your env tool, that does not
> seem to be the case.
> 
> Possibly related: after some googling, I found
> http://stackoverflow.com/questions/603785/environment-variables-in-mac-os-x
> It seems that in Mac OS, you can have different environment variables
> for GUI and for terminal apps. Thus, I would guess that Tw (as GUI app)
> does not get the environment you have in a terminal. I have no idea why
> this problem does not show up in TeXShop, though.
> 
> Out of curiosity: can you reproduce the problem if you start TeXworks
> from the command line?

[~]$ open /Applications/TeX/TeXworks.app

When opening TW from the console like this, the PATH declared in my ~/.bash_profile is known from TW.

However, the paths I declare in the GUI under "Paths for TeX and related programs" are not set.  They don't seem to be passed to the process created to run the processing tool.

>> * * *
>> 
>> As a workaround, I managed to make LaTeXmk work successfully in TeXworks that way:
>> 
>>   1. put "/usr/texbin" in the GUI under "Paths for TeX and related programs"
>>   2. sudo ln -s /usr/texbin/pdflatex /usr/bin/pdflatex (as /usr/bin is passed to the process when typesetting)
>>   3. sudo ln -s /usr/texbin/bibtex /usr/bin/bibtex
>> 
>> ... A bit of tinkering that could prevent people from being stuck with this issue... until it gets fixed :-)
> 
> Personally, I'd prefer to use a wrapper script for latexmk that simply
> sources .bash_profile (provided all other TeX programs work as expected)
> as that would avoid tinkering in system directories with sudo.

Sure, it's cleaner I admit.

> Anyway: as I don't have a Mac to test, I don't really know how to debug
> this further. One possibility would be to replace
>    QStringList env = QProcess::systemEnvironment();
>    QStringList binPaths = TWApp::instance()->getBinaryPaths(env);
> by
>    QStringList env = QProcess::systemEnvironment();
>    qDebug() << env;
>    QStringList binPaths = TWApp::instance()->getBinaryPaths(env);
>    qDebug() << env;
> in src/TeXDocument.cpp, recompile TeXworks, start it from the command
> line and observe the output (this should solve the question what
> environment Tw really picks up and how it is modified once and for all).
> But of course this requires compiling TeXworks from source...

It seems I don't have the proper developing environment (gcc 4.9 instead of gcc 4.0):

  g++-4.9: error: unrecognized command line option '-stdlib=libc++'
  g++-4.9: error: unrecognized command line option '-arch'

I'm sorry I can't investigate this further at the moment...

Anyways, thanks for your help!

Guillaume




More information about the texworks mailing list