0

I am trying to compile a .tex file using AUCTeX on Emacs 27.2. When I run the LaTeX command (via the menu bar) I get the following message:

TeX-command: ERROR: AUCTeX cannot find a working TeX distribution. 
Make sure you have one and that TeX binaries are in PATH environment variable.
If you are using OS X El Capitan or later
remember to add /Library/TeX/texbin/ to your PATH

I have a file called TeX in /etc/paths.d which contains the line /Library/TeX/texbin. And if I open the .tex file with TeXShop it compiles fine. The start of the message file just to prove it:

This is pdfTeX, Version 3.141592653-2.6-1.40.22 (TeX Live 2021) (preloaded format=pdflatex)
 restricted \write18 enabled.
entering extended mode
(./Chapter1.tex

Any help greatly appreciated.

1 Answer 1

0

Ack! I found the answer in another thread, shortly after posting. See AUCTeX cannot find a working TeX distribution. In short, I needed to include the location of my texbin file my init.el. This is done with:

(setenv "PATH" (concat "/Library/TeX/texbin:"
                       (getenv "PATH")))
(add-to-list 'exec-path "/Library/TeX/texbin")

Everything works now. Leaving this here in case anyone else gets some benefit from it.

1
  • You probably want to set the PATH in you shell init file ($HOME/.profile or equivalent): that way, you'll be able to use TeX from a terminal command line as well.
    – NickD
    May 9, 2022 at 15:21

Your Answer

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

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