Update: new info on using launchd instead of Login Items are in the next post
Huzzah! Emacs 23.1 has been released. If you don’t want to wait for someone else to package it up for you, here are some tips for installing and running the latest release on Mac OS X.
First, downlaod emacs-23.1.tar.bz2 from the GNU FTP server. Let’s assume it’s in your Downloads directory. From there you want to do the following in your Terminal
$ cd Downloads
$ tar xjf emacs-23.1.tar.bz2
$ cd emacs-23.1
$ ./configure --with-ns
$ make
$ make install
$ open nextstep
You should now see the Emacs.app application in the nextstep directory. You can drag this to your Applications directory. The first time you run it, OS X may warn you about opening a file downloaded from the internet.
If you want an updated version for the command line, do the following:
$ make clean
$ ./configure --prefix=/usr/local
$ make
$ sudo make install
This will install the new emacs in your /usr/local directory. If you haven’t added that to the path, you should. Or just omit the prefix parameter and install directly in /usr/.
If you want to run the new emacs daemon, you can use a shell script and a little applescript to set everything up.
First, create a new shell script. I put mine in ~/bin/emacsdaemon.sh. It should look like this:
#!/bin/bash
/Applications/Emacs.app/Contents/MacOS/Emacs --daemon
Now, open up the Script Editor and enter the following:
tell application "Terminal"
do shell script "/Users/[YOUR USERNAME HERE]/bin/emacsdaemon.sh"
end tell
Save the file as an Application named Emacs Daemon and drop it into your Applications directory. You can now add this application to your Login Items in your Accounts System Preferences. I also like to change the icon by selecting Get Info from both the Emacs.app and the new Emacs Daemon.app. You can click on the nice emacs icon on the Emacs.app, press Control-C to copy, then select the icon on the Daemon app and paste.
Finally, you can repeat this process to create a new Emacs Client.app by using the following shell script and apple script:
emacsclient.sh:
#!/bin/bash
/Applications/Emacs.app/Contents/MacOS/bin/emacsclient -c
Emacs Client.app:
tell application "Terminal"
do shell script "/Users/[YOUR USERNAME HERE]/bin/emacsclient.sh"
end tell
Now when you log in, emacs will automatically startup in daemon mode. You can then start a new emacs client by either running emacsclient -c in the Terminal or clicking on your shiny new Emacs Client.app.
Commentary