问题背景:macOS系统,在VScode中,Latex在build时报错显示如:

 Recipe ternimated with fatal error: spwan pdflatex/latexmk ENOENT

 

这种错误的原因:本机的tex没有写入到PATH中,或者PATH中的texlive路径是错误的(我的原因就是更新texlive,安装目录名称发生变化)

 

解决办法:

  1. 找到texlive的安装路径,如我的路径是/usr/local/texlive/2021/bin/universal-darwin
  2. 在zshrc或bashrc中写入export  PATH=dir:$PATH