[Tex/LaTex] Mavericks upgrade screwed up the pdflatex (command not found)

auctexemacsmacpdftex

so everything was working fine … until i upgraded to os x mavericks (version 10.9.2) a couple days ago.

using

  • emacs version 24.3 (9.0)
  • auctex version 11.87.3

after upgrade, tried to compile and got:

Running `LaTeX' on `test' with ``pdflatex  -interaction=nonstopmode "\input" test.tex''
/bin/sh: pdflatex: command not found

LaTeX exited abnormally with code 127 at Wed Mar  5 09:45:28

where did my pdflatex go? what is the fix?

Best Answer

Note: users on more recent versions of macOS will not be able to follow these instructions due to new restrictions introduced in those versions. See comments for workarounds.

It seems that the upgrade wiped the link from your Library (where MacTeX puts your actual TeX distribution) into your /usr/texbin. You can reinstate this link with the following:

ln -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin \
      /usr/texbin

This will essentially create a shortcut at /usr/texbin that points to your texbin in MacTeX's internal directory. You still should make sure that /usr/texbin is in your PATH environment variable, though.

NB. If you use DVI → PS → PDF, you may also need to repair the link to Ghostscript:

sudo ln -s /usr/local/bin/gs-noX11 /usr/local/bin/gs