I'm running OS X 10.7 with Emacs 24, Auctex 11.86 and TexLive 2011 via MacTex.

When i run LaTeX through Emacs in the terminal it outputs my test.tex as test.pdf just fine.

However, when i run the same file through Auctex in Emacs.app it fails and I'm given:

LaTex: problems after [0] pages'

and the output reads

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

I've been googling this and know this is a fairly common problem, but for the life of me I haven't been able to implement a fix. From what I've read it seems Emacs has a different PATH than terminal, no? Can someone please explain to me how to fix the PATH or environment variable (I'm not sure which) so that Emacs can find pdflatex. Is there something I need to change in my ~/.emacs?

  • You run emacs in the terminal and it outputs a pdf? You mean you run latex in the terminal?
    – Seamus
    Jul 30, 2011 at 22:14
  • yes latex, my mistake.
    – idclark
    Jul 30, 2011 at 23:05
  • This isn't really a TeX question, but an emacs question. Here are some solutions: EmacsApp. I don't recommend using the environment.plist solutions, as they can interfere with other applications. The "quick and ugly" solution seems the best; you need to change the path accordingly (the path there assume Darwin Ports). For MacTeX you want to make sure that /usr/texbin/ is early in the path. (You also might want to try Aquamacs.)
    – Alan Munn
    Jul 30, 2011 at 23:20
  • finally got it!
    – idclark
    Jul 31, 2011 at 2:32
  • If you have found a solution please report it here as an answer of your own question, so everyone can enjoy of it
    – Spike
    Jul 31, 2011 at 7:06

4 Answers 4


ok, sorry for the delay- i wasn't allowed to post a self-answer earlier. Indeed Emacs.app was operating in a different environment than the terminal.

M-x getenv for PATH showed that /usr/texbin was missing, which explains why LaTex was not working inside the Emacs.app shell.

following @Alan Munn's idea to stay away from editing a .plist I found some good info here and hacked together this in ~/.emacs

(getenv "PATH")
 (setenv "PATH"
 "/usr/texbin" ":"

(getenv "PATH")))

/usr/texbin is now part of thePATH and LaTeX will play nice with Emacs.app

In El Captain, PATH changed. So you should use which latex in terminal to decide the real location. In my machine, it returns /Library/TeX/texbin/latex, so I should use /Library/TeX/texbin/ instead of `/usr/textbin'.

thanks for the help everyone!


There is an emacs package for dealing with this problem on OSX called exec-path-from-shell. You can install it via the list-packages interface. You need to activate it with


in your emacs init file. See https://emacs.stackexchange.com/q/10722/2710.


you can try to add in your .emacs the following command:

(setq exec-path (append exec-path '("YOUR/PATH/TO/LATEXB/BIN/")) )
  • I tried this earlier and unfortunately it didn't work. It's frustrating because I thought this would do the same thing as my fix in the answer post.
    – idclark
    Jul 31, 2011 at 13:07

If you have the root right, you can add the path to the end of /etc/profile like this:

export PATH=$PATH:/work/tools/arc/arcanist/bin:/work/tools/jdk1.6.0_25/bin

I have the same problem in my Linux/Ubuntu 12.04, and it works!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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