skip to Main Content

I have just installed debian 10 as well as vscode. I have been struggling with this for 3 days now.. I installed texlive from terminal with the following command:

sudo apt install texlive

I then installed the latex workshop extension in vscode and tried building a .tex file. The following error popped up:

Recipe terminated with fatal error: spawn latexmk ENOENT.

I then preceded to install latexmk from terminal with:

sudo apt install latexmk

The same error kept popping up after that. The output showed this.

[14:59:34] Recipe step env: {}
[14:59:34] cwd: /home/phoenix/Documents/stellies/year4/2021/s&s-414/pracs/prac-4/report
[14:59:34] LaTeX build process spawned. PID: undefined.
[14:59:35] LaTeX fatal error: spawn latexmk ENOENT, . PID: undefined.
[14:59:35] Does the executable exist? PATH: /app/bin:/usr/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/node/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/cargo/bin:/home/phoenix/.var/app/com.visualstudio.code-oss/data/python/bin
[14:59:35] The environment variable $SHELL: /bin/sh

I then proceded to review the texlive website. I noticed that i did not set the path variable to include the texlive binaries. The texlive website gives the following path to the binary files : PATH=/usr/local/texlive/2021/bin/x86_64-linux:$PATH
however /usr/local/texlive does not exist on my system for some reason. Where can i find the correct path to the texlive binaries on Debian 10?

7

Answers


  1. On Mac, this is a way to fix the issue

    Step1: reinstall mactex by downloading it from this link: http://www.tug.org/mactex/mactex-download.html

    Step2: In your terminal do cd /usr/local, you should see texlive folder

    Step3: In your terminal do sudo vim etc/paths to set the environment. Details are in this link: https://www.architectryan.com/2012/10/02/add-to-the-path-on-mac-os-x-mountain-lion/

    Step4: In your terminal do /usr/local/texlive/2021/bin/x86_64-linux at the bottom. check the folder to see if the year is correct. Details in: http://www.tug.org/texlive/quickinstall.html.

    Step5: Quit VC code completely, and reopen it.

    Login or Signup to reply.
  2. I had this same problem on Mac recently, the fix that worked for me was to uninstall and reinstall the LaTeX Workshop extension.

    Login or Signup to reply.
  3. I had the same problem. The root cause was: (1) software’s bin folder missing from PATH; (2) bad file privileges. Consequently, VSC couldn’t access latexmk, which explains the error messages.

    In my case, the problem occurred on a mac, and specifically after I installed MacTex, which, in turn, installs Tex Live. I believe the same solution may apply to linux distros too.

    Solution:

    1. Claim file ownership (which was originally root) under folder /usr/local/texlive: sudo chown -R <username> /usr/local/texlive, where <username> is the OS-level user name. The fix will work for this specific user. If it is not enough, try instead setting group owner appropriately, and/or consider Step 3.

    2. Add /usr/local/texlive/2021/bin/<software_dialect> to PATH. <software_dialect> depends on the installed software version: in my case it is universal-darwin; on linux it might be x86_64-linux.

    3. If the problem persists, try to change file access permissions under /usr/local/texlive using chmod.

    EDIT: As a final step, restart VSC for changes to take effect.

    Login or Signup to reply.
  4. I recently encountered the same problem on MacOS Monterrey (M1 based). I used basictex (just for the context). As required by the installation instruction,

    1. I added TeXLive to PATH,
    2. installed latexmk package to the TeX distribution.

    However, still got the same error as OP.

    Afte reading the wiki again more carefully, what finally worked for me was as simple as restarting VS Code and MacOS. Everything works as expected after a reboot of the MAC.

    Login or Signup to reply.
  5. I got the same issue , seems to be a misbehaving from Vscode on MacOS

    • check if the command is in the path on mac

    which command_you are running example which latexmk

    If this output something that means you have your latex installed, otherwise go and installed it and make sure it is accessible via command line.

    • If latex is installed and you are getting that issue you can just restart your VSCode and everything will be okay.
    Login or Signup to reply.
  6. Had a similar error and came across this post when looking for a solution.
    I wanted to use texlive on Vscode with WSL2 on Windows 10. Installing texlive-full in wsl fixed this error for me.

    Login or Signup to reply.
  7. The error message "Recipe terminated with fatal error: spawn latexmk ENOENT" suggests that the latexmk command cannot be found in the system path.

    To resolve this issue, you can add the path to latexmk to your system environment variables:

    Open the Start menu and search for "Environment Variables".
    Click on "Edit the system environment variables".
    Click on the "Environment Variables" button.
    Under "System Variables", scroll down and find the "Path" variable.
    Click on "Edit" and then "New".
    Enter the path to the directory where latexmk is installed (e.g. C:Program FilesMiKTeX 2.9miktexbin) and click "OK".
    Restart Visual Studio Code and try compiling your LaTeX document again.
    If latexmk is not installed on your system, you can install it using a LaTeX distribution such as MiKTeX or TeX Live. Once installed, the path to latexmk should be automatically added to your system environment variables.

    If the issue persists, you can try specifying the full path to latexmk in your LaTeX Workshop settings by adding the following line to your settings.json file:

    "latex-workshop.latex.tools": [
    {
        "name": "latexmk",
        "command": "C:/Program Files/MiKTeX 2.9/miktex/bin/latexmk.exe",
        "args": [
            "-synctex=1",
            "-interaction=nonstopmode",
            "-file-line-error",
            "-pdf",
            "%DOC%"
        ],
        "env": {}
    }
    

    ]

    Make sure to update the path to latexmk to match the location where it is installed on your system.

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search