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

Stefan Löffler st.loeffler at gmail.com
Sun Oct 19 20:01:36 CEST 2014


On 19.10.2014 19:15, Guillaume Cabanac wrote:
> Then I added the source command on line 2:
> -----------------------------
> #!/bin/sh
> source ~/.bash_profile
> env
> -----------------------------
> The result displays the correct PATH:
> Conclusion: the PATH does not seem to be passed to the process.

OK. So one possible solution would be to write a wrapper script of
latexmk on Mac OS which just sources .bash_profile and then passes on
all arguments to latexmk. Ugly, I admit, but without the need for much

>> Does Tw still find latexmk if you remove all paths from the preferences
>> (it should, if it picks up $PATH correctly).
> When I remove all paths in the GUI under "Paths for TeX and related programs" I get an error dialog:
>   "The program latexmk was not found".

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
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?

> * * *
> 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.

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);
    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...


More information about the texworks mailing list