[Tex/LaTex] TeXstudio + Latexmk won’t compile (with OS X): “Error: Could not start command: …”

compilinglatexmkmactexlivetexstudio

UPDATE: John reported the bug in the TeXstudio forum, and they fixed it. The development version TeXstudio 2.10.9 (hg 5929:7315f2e5eed3) works, when you change the Latexmk command to "latexmk -pdf -silent -synctex=1 %"

I recently switched from Texmaker to TeXstudio (version 2.10.8). In Texmaker, I used to compile my document with Latexmk. In TeXstudio, however, the default Latexmk command returns an error message. I work with OS X Yosemite (version 10.10.5) and TeX Live. Here is an example:

\documentclass[10pt, a4paper]{article}
\usepackage[T1]{fontenc}
\usepackage[utf8]{inputenc}
\usepackage[ngerman]{babel}
\usepackage{hyperref}

\begin{document}
Some text.
\end{document}

My build settings in TeXstudio (Default compiler = Latexmk):
my build settings in TeXstudio: Default compiler = Latexmk

And the corresponding command settings (latexmk -dvi -silent %):
my command settings in TeXstudio: Latexmk = latexmk -dvi -silent %

And this is the error I get:
enter image description here

The document compiles normally when I choose PdfLaTeX instead of Latexmk.
I have seen related posts on stackoverflow, but none these included a solution for Latexmk. Does anybody know a solution to this problem?

EDIT: As ig0774 suggested, I changed the path to /usr/texbin/latexmk -dvi -silent % and pressed OK. When reopening the settings of TeXstudio, the path was set back to latexmk -dvi -silent %. Is this a bug or am I missing something?

Best Answer

You need to change the latexmk command to start with /usr/texbin/latexmk. By default, /usr/texbin is not part of the PATH from GUI applications.


Edit

Alright, a better suggestion:

  1. Quit TeXStudio completely
  2. Open the file "~/.config/texstudio/texstudio.ini" in a text editor (you can use open -a TextEdit ~/.config/texstudio/texstudio.ini from the terminal or any other text editor you like).
  3. Find the line that starts "Tools\Commands\latexmk=", replace everything to the right of the equals sign with /usr/texbin/latexmk -dvi %
  4. Launch TeXStudio

This should make the necessary change and persist it across restarts (hopefully... at least it works for me...)