I'm using GNU Emacs from emacsformacos.com After Migration to OSX 10.11 "El Capitan", Auctex can't run the *tex utilities anymore:

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

There is no problem running for example pdflatex on the shell:

This is pdfTeX, Version 3.14159265-2.6-1.40.16 (TeX Live 2015) (preloaded format=pdflatex)
 restricted \write18 enabled.

but it seems that auctex calls /bin/sh pdflatex instead, and that does not work anymore:

/bin/sh pdflatex
/Library/TeX/texbin/pdflatex: /Library/TeX/texbin/pdflatex: cannot execute binary file

maybe due to El Capitan's changes to Gatekeeper sandboxing. How can I configure auctex to run pdflatex again?

2 Answers 2


The problem was the PATH variable that Emacs uses (and passes on to shells it runs) is different from the users PATH variable. To customize Emacs' PATH one can use

(setenv "PATH" "/usr/local/bin:/Library/TeX/texbin/:$PATH" t)

With this change, AucTeX can call the command line programs again. See also this question.

Update (Nov 2015): In AucTeX 11.88.9 another check was installed to see if the command line programs are reachable. Even if the above method works, this check is more restrictive since it looks if the tex binaries are in the emacs path. To pass this check, /Library/TeX/texbin has to be added also to the exec-path variable. To do so, add this to your init file:

(setq exec-path (append exec-path '("/Library/TeX/texbin")))
  • It's true the check is more restrictive but it's a good idea to have exec-path well set anyway because it's used elsewhere (for example in TeX-doc)
    – giordano
    Nov 3, 2015 at 10:33

El Capitan doesn't allow writing directly in /usr so the usual symbolic link to the TeX binaries, /usr/local, is removed when El Capitan is installed and can't be rebuilt. To compensate for that MacTeX-2015 and BasicTeX-2015 also install another symbolic link, /Library/TeX/texbin, in /Library/TeX which writable. The PATH for the CLI is set to include that link rather than /usr/texbin so it works out of the box. However many GUI applications need to be reconfigured.

I'd really like to get more details about where to put the line

(setenv "PATH" "/usr/local/bin:/Library/TeX/texbin/:$PATH" t)

to reconfigure Aquamamcs/AUCTeX since I'm not a user but others I'm in contact with are users.

  • Answering your question, that line must be put in your init file.
    – giordano
    Oct 25, 2015 at 12:53
  • Hmmm... created the file init.el with the line above. I placed init.el in ~/.emacs.d/ which already exists in my HOME directory. But Aquamacs still doesn't seem to be able to compile my file. Is there some other incantation I have to use so that Aquamacs will automatically execute init.el? Oct 26, 2015 at 13:07
  • If I remember correctly aquamacs uses other places for the init file, try googling it.
    – giordano
    Oct 26, 2015 at 19:13

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .