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


  • 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?

  • 1
    Presumably the texbin setup that mactex usuall installes got wiped during the upgrade. I've also seen this happen with TeXLive on windows 8 that was then updated to 8.1. The PATH addition was lost. Sadly I do not know which programmes to run on the Mac to get those paths (and texbin setup again). Have you searched the HD to see if pdflatex is still in the system folder? – daleif Mar 5 '14 at 17:19
  • 5
    what does echo $PATH say? And I'm not sure, but try ln -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin /usr/texbin. – Sean Allred Mar 5 '14 at 17:32
  • Welcome to TeX.SX! You can have a look at our starter guide to familiarize yourself further with our format. – Martin Schröder Mar 5 '14 at 17:39
  • @daleif There is no 'system folder'. Certainly none which should house pdflatex. Perhaps you are thinking of traditional Mac OS (through Mac OS 9.*)? – cfr Mar 6 '14 at 0:58
  • This is what I use in my .emacs file for Snow Leopard: (setenv "PATH" (concat (getenv "PATH") ":/usr/texbin")) Try also generating a latex document from Terminal.app without using Emacs to see if your TexLive installation is intact. If it is not, then reinstall TexLive. – lawlist Mar 6 '14 at 7:28

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 \

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
  • my echo $PATH says /usr/texbin:/usr/bin:/bin:/usr/sbin:/sbin. Is this all right? – MichaelWBratton Mar 6 '14 at 17:24
  • 1
    @SeanAllred: Many thanks. +1. Just posted a follow up question on this here. – Shambho May 13 '14 at 17:53
  • 1
    I'm not familiar with Terminal & when I tried to do this I got a "permission denied" error (despite being logged in as admin). After a quick search, I found that you can either precede the command with 'sudo' or, if it was the last command entered, then you can just type 'sudo !!' and it'll prompt you for your password. After this, it worked perfectly for me. Thank you! – Rax Adaam Sep 13 '14 at 15:41
  • 2
    Those running the El Capitan beta might find this useful: apple.stackexchange.com/a/196226/87067 (sorry, this comment will become redundant after release) – David Lord Jul 29 '15 at 9:43
  • 3
    This is for El Capitan users! Pdf for Settings – eleijonmarck Oct 13 '15 at 17:44

For those less comfortable with the command line: I had this problem after upgrading to OSX 10.9.2 as well. After the upgrade, in my /Applications/TeX/ directory I found a FixMacTeX2013.pkg. Running this fixed the pdflatex issue.

  • 3
    I tried this, didn't work! – martina Apr 16 '16 at 14:29
  • This just added the links to /Libraries/TeX/texbin After this I added the /Libraries/TeX/texbin to $PATH – Thomas K Nov 9 '17 at 14:10

The suggestion

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

did not quite work for me, because in my /Library/.../Programs I do not have the directory texbin, but rather two directories: i386 and powerpc. I have an Intel processor and thus used:

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

which worked fine.

  • Casualty of autocorrect: the command that worked is: ln -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/i386 /usr/texbin – Elizabeth Meckes Jun 10 '14 at 12:00
  • I fixed the appearance of code and also changed Texan to texbin. You can always edit your own (and also others') posts. Welcome to TeX.SX! – egreg Jun 10 '14 at 12:02
  • $ sudo ln -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin \ > /usr/texbin ln: /usr/texbin: Operation not permitted – Mona Jalal Sep 12 '17 at 2:39
  • $ ln -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/i386 \ > /usr/texbin ln: /usr/texbin: Operation not permitted – Mona Jalal Sep 12 '17 at 2:39

First go to the TeXworks preferences to add /usr/Texbin to the path. May cure the problem without having to create the symbolic links.

  • 4
    This is rather a comment than a comment – user31729 Jun 11 '14 at 15:08

In summary, all you have to do is to add /usr/texbin to the environment variable $PATH. Using Terminal you can do it in 3 steps:

1) Ensure that pdflatex command is installed in /usr/texbin

mac:yourname$ ls /usr/texbin
afm2tfm          dvired           initex           luaotfload-tool  mktexlsr         simpdftex        texluajitc
allcm            dvitomp          kpseaccess       luatex           mktexmf          synctex          thumbpdf
allec            ebb              kpsepath         makeindex        mktexpk          teckit_compile   tlmgr
allneeded        etex             kpsereadlink     man              mktextfm         tex              updmap
bibtex           extractbb        kpsestat         mf               mpost            texconfig        updmap-sys
dvi2fax          fmtutil          kpsetool         mf-nowin         mptopdf          texconfig-dialog xdvi
dvilualatex      fmtutil-sys      kpsewhere        mfplain          pdfetex          texconfig-sys    xdvi-xaw
dviluatex        gftodvi          kpsewhich        mft              pdflatex         texhash          xdvipdfmx
dvipdfm          gftopk           kpsexpand        mkindex          pdftex           texlinks         xelatex
dvipdfmx         gftype           latex            mkocp            pktogf           texlua           xetex
dvipdft          gsftopk          luajittex        mkofm            pktype           texluac
dvips            inimf            lualatex         mktexfmt         rungs            texluajit

2) Print the old $PATH value

mac:yourname$ echo $PATH

3) If /usr/texbin is not part of $PATH value you can append it by adding or editing your .profile file (needs superuser permissions)

mac:yourname$ sudo vi /Users/yourname/.profile

\#This is the concerned part of .profile
export PATH=/usr/local/bin:$PATH:/usr/texbin

After saving the file, you can restart Terminal or open a new window/tab.


The document I am working on has a compile system that runs pdflatex and I hit the same problem. I just downloaded and installed MacTeX on Mavericks, which added /usr/texbin to my PATH, which contains 23 links to pdftex, however pdflatex is not one of them. The following fixed it for me:

cd /usr/texbin
ln -s pdftex pdflatex

protected by Community Feb 27 '16 at 15:43

Thank you for your interest in this question. Because it has attracted low-quality or spam answers that had to be removed, posting an answer now requires 10 reputation on this site (the association bonus does not count).

Would you like to answer one of these unanswered questions instead?

Not the answer you're looking for? Browse other questions tagged or ask your own question.