36

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?

MichaelWBratton
  • 463
  • 1
  • 4
  • 5
  • 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 05 '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 05 '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 05 '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 06 '14 at 00: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 06 '14 at 07:28
  • @cfr, by system folder I'm of course referring til the folder(s) where programs is placed on a mac. Tl is installed by root on the mac, so the files end up in the system folder hierarchy. I do not remember where. These folders are hidden from the user if you are using finder to browser (unless you go through Go). Might be easier to just run a "find" on the command line – daleif Mar 06 '14 at 08:11
  • i think the ln -s solution by @SeanAllred has worked. things appear to be going all right now. – MichaelWBratton Mar 06 '14 at 15:36
  • @daleif OK. But 'system folder' is misleading in a Mac context because it means something different. Also most of TL is not stored in the hierarchy where system programmes are stored (or, for that matter, where third party .apps are stored). Most of it goes under /usr/local/ which is explicitly system-independent. That's why the ln -s solution can work. Although link under /usr is gone, the distribution in /usr/local and the Mac config under /Library remains. – cfr Mar 06 '14 at 16:52
  • The simplest workaround is to change the path to your distribution in Preferences of Tex Live utility. –  Oct 01 '15 at 09:19
  • This seems to be happening with Sierra as well. – StatsSorceress Aug 04 '17 at 16:08

6 Answers6

32

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
Sean Allred
  • 27,421
  • my echo $PATH says /usr/texbin:/usr/bin:/bin:/usr/sbin:/sbin. Is this all right? – MichaelWBratton Mar 06 '14 at 17:24
  • @MichaelWBratton Looks solid. :) – Sean Allred Mar 06 '14 at 19:07
  • 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: http://apple.stackexchange.com/a/196226/87067 (sorry, this comment will become redundant after release) – David Lord Jul 29 '15 at 09:43
  • 3
    This is for El Capitan users! Pdf for Settings – eleijonmarck Oct 13 '15 at 17:44
  • I've just upgraded to Sierra (OS 10.12), and this command does not seem to work for me. sudo doesn't help. got message "ln: /usr/texbin: Operation not permitted". If I go into /usr I can't even make a directory texbin with mkdir. – Joel Apr 03 '17 at 04:53
  • @Joel see the comments above concerning El Capitan (which unilaterally removed write access to these directories). – Sean Allred Apr 03 '17 at 14:08
18

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.

Alan Munn
  • 218,180
5

The suggestion

ln -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/texbin \
      /usr/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 \
      /usr/texbin

which worked fine.

egreg
  • 1,121,712
  • 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 02:39
  • $ ln -s /Library/TeX/Distributions/.DefaultTeX/Contents/Programs/i386 \
      /usr/texbin
    

    ln: /usr/texbin: Operation not permitted

    – Mona Jalal Sep 12 '17 at 02:39
2

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

JMH
  • 21
  • 1
2

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
/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin

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.

Guido
  • 30,740
alemol
  • 21
0

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
Joseph Wright
  • 259,911
  • 34
  • 706
  • 1,036