I have installed TexLive on Ubuntu 20.04.1 LTS using

sudo apt-get install texlive

After this I created a file "text.tex" in Visual Studio Code. I installed the Plugin "Latex Workshop" and tried to preview or Build the .tex File.

I received the following error:

Recipe terminated with fatal error: spawn latexmk ENOENT.

According to this:


The reason for this is, that something is wrong with the PATH Variable

I am not sure whether TexLive is actually included in my PATH:

Using echo $PATH yields:


I can use latex-v and which latex yields:


TexLive itself is located at:


I have tried to debug this by following the advice from the github page - I copied the content of m PATH variable into the "env" fields in the settings.json of LatexWorkshop, however, the error persists.

Someone solved a fairly similar problem here: How can I get VS Code LaTeX Workshop to choose the correct Latex distribution? This was on Windows however.

I am not sure whether something is wrong with my TexLive installation, my PATH variable or something is buggy or falsely set up within VSCode/LatexWorkshop.

  • 2
    Have you checked that you actually have latexmk? Ubuntu breaks texlive up into a number of Ubuntu packages (not to be confused with latex packages). You can use the apt-file tool to figure out which Ubuntu package provides latexmk (apt-file search latexmk), I think it is called latexmk. Note that apt-file needs sudo apt-file update from time to time. – daleif Jan 25 at 14:47
  • @daleif That was just it. Just reinstalled it using sudo apt-get install latexmk. Now everything works as intented. TY! – MrTony Jan 25 at 15:19

On Ubuntu TeXLive is split into many Ubuntu packages (not related to LaTeX packages). Some of the software tools that come with TeXLive are also split into their own Ubuntu packages. And since installing the Ubuntu texlive package does not install everything TeXLive relatated, chances are that you are missing something.

In this case the Ubuntu package latexmk provides the latexmk tool.

I looked it up via apt-file search latexmk. Note that other Ubuntu packages match as well but that is mostly latexmkrc configuration files.

Note if you use the apt-file tool, remember to run sudo apt-file update from time to time. This updates the file lists that apt-file search searches.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.