Installing AucTeX 1.86 over Emacs.app in OS X

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">
<dict>
<key>PATH</key>
<string>/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/texlive/2009basic/bin/universal-darwin</string>
</dict>
</plist>

AUCTeX should behave nicely now.