I installed latex workshop in VSCODE (on Mac OS), but the pdf does not build. Instead it throws the error:
Recipe terminated with fatal error: spawn pdflatex ENOENT.
Does anyone know the solution as I would have assumed the package would work by simply installing?
2
Answers
I found this issue to occur when launching VSCODE from the anaconda GUI. Launching VSCODE directly in launchpad on MAC OS did not through any errors and simply compiled and built the pdf. Hence, this issue appears to be specific to the anaconda installation and launch.
You need to install MacTex for Latex Workshop to work. After installing MacTex, you’ll see TexLive Utility which you will use to install all the packages.
If you have all of it installed, then it throws an error because the environment variable is not set in PATH. You can check this by typing
echo $PATH
in your terminal or reading the error message in the log.To fix this:
Open your Library folder and navigate over to TexShop. Open "Engines" and move latexmk engine from "inactive" back to "Engines" folder.
After doing this, you have to add
/usr/local/texlive/2022/bin/universal-darwin
to your$PATH
.Open Terminal and type
ls -a
to view all files.Type
open .zshrc
in the terminal and add/usr/local/texlive/2022/bin/universal-darwin:
afterbin:
. Save the text editor and close it.Now, type
source .zshrc
in the terminal.Restart your Visual Studio Code, and it should work. Type
echo $PATH
in Terminal and you should be able to see the path we just added.