TeX Live 2020 Installation

August 5, 2020


Somehow I crashed my TeX today and could not fix it. So, I decided to delete it and download the latest version. However, instead of downloading MacTeX (which could have saved me tons of trouble), I downloaded TeX Live 2020 (which cost 3.5 hours) and TeXShop separately. What a fool. To shake off the shame, I spent the next 3.5 hours to figure out how to make them work together, feeling like a smart fool now. Below are my notes.

TeX Live Configuration

Delete TeX Live 2016 in Terminal.

rm -R /usr/local/texlive/2016

Install TeX Live 2020 from the install-tl GUI. Find out where is pdflatex and/or ptex2pdf.

which pdflatex
which ptex2pdf

Reset the PATH according to step 2.

PATH=/usr/local/texlive/2020/bin/x86_64-darwin:$PATH

Now the pdflatex should work in the terminal, which prints out a PDF file on your desktop.

cd ~/Desktop
pdflatex sample2e.tex

TeXShop Configuration

In the Preferences… menu, Engine tab:
  • (Bottom left) Set Default Values: ptex2pdf.
  • Path settings: /usr/local/texlive/2020/bin/x86_64-darwin/
  • pdfTeX: Use the default for Tex pdftex --file-line-error --synctex=1 and Latex pdflatex --file-line-error --synctex=1.

In the Typeset menu, select both LaTeX and Pdftex.

R/RStudio Configuration

I also updated the PATH variable in R, so I can compile R Markdown to PDF files. In R console,

> Sys.getenv(“PATH”)
> Sys.setenv(PATH=paste(Sys.getenv(“PATH”),“/usr/local/texlive/2020/bin/x86_64-darwin”,sep=“:”))


Hoorey! Almost everything works again after I completely wiped out TeX Live 2020 and TeXShop, and reinstalled them from MacTeX-2020. Yes, I lost my patience in debugging. Before the wipe-out, TeX Live 2020 worked perfect in Terminal when the TeX files were run by pdflatex. However, neither TeXShop nor RStudio compiled successfully. Ironically, the problems with TeXShop and RStudio did not go away for certain TeX files even after MacTeX-2020 was installed. So I guess I could have fixed those glitches had I known about the following few things.

  • When typesetting in TeXShop, I have to switch LaTeX to pdflatexmk in certain cases.
  • For errors about missing sty file:
    • First try to locate them. Typically, it is in /usr/local/texlive/2020/texmf-dist/tex/latex/.

      kpsewhich PackageName.sty

    • If it is truly missing, then download it from CRAN.

    • Find out the TeX home directory:

      kpsewhich -var-value=TEXMFHOME

      For Mac, it is typically ~/Library/texmf/. Next, add the missing sty file to the TeX home directory. For example, ~/Library/texmf/tex/latex/local/. Create the local folder if it does not exist.

    • The particular sty file that I had trouble with was mcexam.sty. The trouble is solved based on this StackExchange thread.

  • By the way, now in TeXShop Preferences... menu, Engine tab, the default path setting /Library/TeX/texbin should be okay, thanks to MacTeX.