Emacs App (v 23) for Mac OS X & environment.plist

Emacs
Mac OS X
Author

Vinh Nguyen

Published

July 16, 2009

Ever since i bought my macbook i've been using carbon emacs (v 22) as my emacs of choice since it has everything emacs and works well with OS X (I didn't want to use Aquamacs because I'm more of a unix person than Mac).

Recently, I discovered Emacs App and wanted to migrate over since

  1. it is emacs v 23, and
  2. it uses Cocoa, a newer technology than carbon and is the standard on Mac OS X these days.

I wanted to use Vincent Goulet's modified binary version of Emacs App, however, ESS gives me weird characters. Thus, I decided to just compile Emacs App myself.

  1. Downloaded emacs app source via CVS.
  2. ./configure –with-ns
  3. make
  4. make install

Step 3 will make Emacs.app in ./nextstep/. Now, install ESS (ESS: download and put in ~/elisp, edit .emacs for load) and AucTeX. AucTeX:

  1. .configure –with-emacs=~/Downloads/emacs/emacs/nextstep/Emacs.app/Contents/MacOS/Emacs –with-lispdir=/usr/local/share/emacs/site-lisp –with-texmf-dir=/usr/local/texlive/texmf-local
  2. make
  3. sudo make install

ESS works. However, AucTeX doesn't because it doesn't see the PATH to latex/pdflatex. This is because Emacs.app acts like a Mac program, so it doesn't have access to it as defined in my .bashrc. To do so, we must edit/make ~/.MacOSX/environment.plist , a file that is analogous to .bashrc but for Mac GUI programs.

FIX (<http://www.emacswiki.org/emacs/CarbonEmacsPackage> [unix and mac path] ) In terminal, type: defaults write ${HOME}/.MacOSX/environment PATH "${PATH}"

then restart (log out) computer to take effect.

To update the path of environment.plist at every login, do (credit here): #/etc/profile begin

if [ -x /usr/libexec/path_helper ]; then eval /usr/libexec/path_helper -s defaults write $HOME/.MacOSX/environment PATH "$PATH" fi

#/etc/profile end

in /etc/profile

UPDATE 2: it appears launching emacs 23.1 through spotlight will not pick up the ENV variables. launching through Finder or the shell is fine. Don't know why. this is weird!

UPDATE 3: did some googling about environement variables, and this, this, and this site taught me how to fix the PATH issue when launching using spotlight. So i just need to put the following in my /etc/launchd.conf file: setenv PATH opt/local/bin:/opt/local/sbin:/sw/bin:/sw/sbin:/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/texbin:/usr/X11/bin:/usr/X11R6/bin:/Users/vinh/Documents/bin:/opt/local/bin:/opt/local/sbin:/usr/texbin

restart computer and things should be working GREAT!

i usually update my PATH in .bashrc, so whenever i update it, just echo $PATH and update the launchd.conf file.

another way to fix all this is to set the PATH (exec-path) inside .emacs, like here.