I have a Macbook. I just installed Emacs and AUCTeX. I then installed MacTeX. When I open a .tex file, and try to compile it into pdf, it gives an error message of "AUCTeX cannot find a working TeX distribution." It also says to add a certain directory to my PATH. How do I correct this? Thanks.

  • Yes, download/install MacTex and make sure your $PATH in Emacs is pointing towards your TexLive installation. There is an optional Emacs library that you can install which will look up the system shell path and add it to Emacs ... just do a little Googling and you will find at least 3 prior threads that deal with that issue and they talk about that optional library that you can install .... I set the $PATH in a different way and do not use AUCTeX ... but there are lots of ways to do it.
    – lawlist
    Oct 20, 2017 at 2:16
  • 1
    Have you tried? What happens when you do?
    – Dan
    Oct 20, 2017 at 10:06
  • @Dan I downloaded and installed Emacs and MacTeX. When I open a .tex file using Emacs, it will open it in AUCTeX. But, when I try to compile to pdf, it says ERROR: AUCTeX cannot find a working TeX distribution.
    – J126
    Oct 20, 2017 at 16:20
  • @lawlist I googled "Emacs library that you can install which will look up the system shell path", but don't understand what I'm looking for.
    – J126
    Oct 20, 2017 at 16:22
  • 1
    Please edit your question to include the information about what you did and what error message you're getting. The package @lawlist is referring to is exec-path-from-shell.
    – Dan
    Oct 21, 2017 at 0:33

1 Answer 1


MacTex is installed alike to a typical Mac application, not like regular TeXLive distributions which are installed in the classic filesystem hierarchy (which means, {la,pdf,xe}tex reside in /usr/bin and can be found by any program). Hence, the path /<where-you-installed-MacTeX>/bin needs to be added to the system-wide variable $PATH. Some other variables which are relevant to tex itself need also be set. Otherwise, MacTex just resides by itself in the directory where you installed it and can neither be found by Emacs nor be used by it without errors. In addition, you need to tell auctex which tex binary to use; this is easiest done via M-x customize-group auctex and setting the tex-command.

For somebody completely new to this, setting up the combo of MacTex and Emacs/AucTeX is not exactly easy, but manageable. I strongly advise to look into the MacTex FAQ on their site.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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