I am trying to install AucTeX 1.86 over an Emacs binary (version 24.0.50) from emacsformacosx.com. On first attempt ./configure outputs:

configure: error: Cannot find the texmf directory!
Please use --with-texmf-dir=dir to specify where the preview tex files go configure: error: ./configure failed for preview

I add --with-texmf-dir=/usr/local/texlive/texmf-local, to which ./configure replies happily with several congratulations. I compile with make and sudo make install without a glitch.

I open a .tex file on Emacs and AucTeX does not load. I issue (load auctex.el nil t t) C-j in the *scratch* buffer and Emacs outputs:

Debugger entered--Lisp error:(file-error "Cannot open load file" "auctex.el")

Something is up. I figured Emacs could not find the file, so it must have not installed where it was supposed to. I track down most of AucTeX files to /usr/share/emacs/site-lisp, where Emacs 22.1 lives.

I had two options here: 1. tell Emacs where to find AucTeX (which I don't know how to do); 2. recompile AucTeX with more configuration options (which seemed more straight forward).

I chose to recompile, after deleting all AucTeX files from the previous installation. This time I configure the source, telling it where the Emacs it should use is, with:

./configure -with-emacs=/Applications/Emacs.app/Contents/MacOS/Emacs --with-lisp-dir=/Applications/Emacs.app/Contents/Resources/site-lisp --with-texmf-dir=/usr/local/texlive/texmf-local

This time it complains:

`configure: error: Cannot locate lisp directory,`
`use  --with-lispdir, --datadir, or possibly --prefix to rectify this`

even though I included the --with-lisp-dir=dir option. If I take it out, it still complains about not being able to find the lisp directory. AucTeX does not seem to like the Emacs.app in the Applications folder.

My question is, how do I get this to work?

3 Answers 3


Here's how I got Auctex to work with pure Emacs:

  1. Install the MacTeX distribution package
  2. Download OS X emacs, place in /Applications
  3. Download the Auctex tarball
  4. Go to the Auctex directory, configure with the command:

    ./configure --with-emacs=/Applications/Emacs.app/Contents/MacOS/Emacs --with-lispdir=/Applications/Emacs.app/Contents/Resources/site-lisp --with-texmf-dir=/usr/local/texlive/texmf-local
  5. Execute:

    make; sudo make install

    to install the elisp files inside the Emacs.app, the info files to /usr/local/share/info, etc.

  6. Edit your ~/.emacs file to load Auctex/preview-latex, and point Emacs to your Latex executables:

    (setenv "PATH" (concat "/usr/texbin:/usr/local/bin:" (getenv "PATH")))
    (setq exec-path (append '("/usr/texbin" "/usr/local/bin") exec-path))
    (load "auctex.el" nil t t)
    (load "preview-latex.el" nil t t)
  7. Auctex and preview-latex should work now. One thing to keep in mind: with older versions of Auctex, the ps pathway seems to work better than pdf; if preview-latex images aren't appearing with the error "/typecheck in --setfileposition--", try disabling "Generate PDF" via "Menu Bar -> Command -> TeXing option".

Update: Steps (2--5) can be replaced with the Homebrew package manager:

brew install emacs --cocoa
brew install auctex

The other steps are still correct. The Emacs "Generate PDF" option now works for me.


From the Mac/GNUstep manual, instances of Emacs launched form the Finder do not inherit environmental variables, so they need to be set. /etc/path and /etc/path.d/ will set the environmental variables system wide, but to have to have them available for the GUI (Finder-launched instances) they need to be set in the the ~/.MacOSX/environment.plist file.

The directory and file have to be created by the user. Once that is done, paste the following (modifying where required) into your environment.plist file. I got this from a message in a mailing list found at http://newsgroups.derkeiler.com/Archive/Comp/comp.text.tex/2009-12/msg00199.html.

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd";>
<plist version="1.0">

AUCTeX should behave nicely now.


To get AUCTeX to load, the .emacs file needs to be modified. From the AUCTeX Manual :

With Emacs (or if you explicitly disabled use of the package system), the startup files ‘auctex.el’ and ‘preview-latex.el’ may already be in a directory of the ‘site-start.d/’ variety if your Emacs installation provides it. In that case they should be automatically loaded on startup and nothing else needs to be done. If not, they should at least have been placed somewhere in your load-path. You can then load them by placing the lines

(load "auctex.el" nil t t)

(load "preview-latex.el" nil t t)

into your init file.

If you explicitly used --with-lispdir, you may need to add the specified directory into Emacs’ load-path variable by adding something like

(add-to-list 'load-path "~/elisp")

before the above lines into your Emacs startup file.

There is no ~/elisp directory in my system, so I add the directory specified in the configuration: (add-to-list 'load-path "/Applications/Emacs.app/Contents/Resources/site-lisp"). This seems to do the job of loading AUCTex whenever a .tex file is opened in Emacs. For some reason the toolbar is not enabled by default.

The AUCTeX hooks are now applied. However, trying to latex a document exits with an error:

/bin/sh: pdflatex: command not found

It seems that this is a $PATH$ problem.

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.