I have been using Texstudio as my tex editor for a couple of years. And I am recently curious about AUCTex on Emacs. I am learning Emacs from literally zero. And I am mostly a writer, not a programmer, so I am not terribly familiar with all kinds of computer skills.

When I typeset latex files, my Emacs says, ''Error: AUCTex cannot find a working tex distribution.'' and it reminds me to add Library/Tex/texbin/ to my PATH. I searched online and there are some solutions. But the problem is, since I have not used Emacs before, I do not even know how to start. For example, here How to use Auctex in MacOS El Capitan? tells me how to solve the problem. But I do not know how to do it. For example, it says,

To customize Emacs' PATH one can use

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

But I do not know what it even means. What does it mean to "customize Emacs' PATH"? Should I use terminal? What should I deal with what is written in the parenthesis? (Most information I found online assumes some background knowledge that I lack.)

Maybe this just means that Emacs is not for me and I should stay with Texstudio or Texshop...

  • I already answered your question in the comments to one of answers you linked: «that line must be put in your init file». It's true that Emacs isn't probably a program that can be used at best without any knowledge, but this shouldn't prevent you from learning it better if you think it's a very good editor (as it actually is ;-).
    – giordano
    Dec 18, 2016 at 10:36

1 Answer 1


Hong, I think, Emacs is worth the time, you need to learn it.

I personally think, it would be more promising, to expand the search PATH variable in your Login-Environmeht instead of (partially) expand your search path only for emacs.

MacOS, being a UNIX-like OS, will set a search path every time a user logs into the system. You can easily check the actual value of your search by, by opening a terminal and typing echo $PATH. In my case it gives

tmjb@Grautvornix:~$ echo $PATH

If you try to run a command, a program (or app, if that is more familiar to you), the operating system will search in those directories, if it can find the requested command. In my case, it would first look into /usr/bin and afterwards in /bin and so an.

You can easily find out, in which directory the command is located by using the special command which in your terminal. Here is an example for finding the LaTeX program.

tmjb@Grautvornix:~$ which latex

If you get an answer similar to this, everything is fine. If you get something like

tmjb@Grautvornix:~$ which emacs

you can even start emacs from your Terminal. In that case, emacs will inherit the search PATH of your shell and should therefore find any TeX-and-friend command, it would find in the Terminal.

(But be warned: emacs in the Terminal might be some different emacs, than those emacs you start from your applications folder!)

If Emacs is something different, you'll have to insert the above Code from your question

(setenv "PATH" "/usr/local/texlive/2016/bin/x86_64-darwin/:$PATH" t)

into your emacs personal configuration file. To do so, try to open ~/.emacs by typing

C-x C-f ~/.emacs RET

Probably you will get an empty file, but sometimes there was a template installed with emacs. Be sure, that the above line contains the directory portion of the answer, the which latex command in the Terminal gave you. If so, just copy the code into that file and save it via

C-x C-s

than quit emacs and start it again.

Hopefully, you won't get an error message but AUCTeX will find your TeX-binaries.

  • @H.Hong: I am glad to hear that :-)
    – Jan
    Dec 19, 2016 at 17:42
  • 1
    Adding to this good generic answer, in the particular case of Mac OS it may be useful to install the package github.com/purcell/exec-path-from-shell
    – giordano
    Dec 19, 2016 at 20:31

You must log in to answer this question.

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