'(Lisp Notes (OS X Intel))

This document attempts to get you up and running with a Free Lisp environment quickly and with little fuss. Following the instructions here will get you the Lisp environment I currenly have setup at this writing. If you haven't already seen it, you should also have a look at my Lisp Development page to see what you can expect. I haven't touched the page in a while, but it is still relevant.

At this time I am running OS X 10.4.9 on a 17" MacBook Pro. If you are running a PowerPC Mac, then you should look at my no longer maintained PowerPC page which describes the Lisp environment I had setup on my PowerBook G4.

The Apple Developer Tools

The OS X 10.4 (Tiger) install CDs include Xcode, the Apple developer tools I am talking about in this section. I am currently using Xcode 2.4.1 which can be downloaded from the Apple Developer Web Site:


The Apple Developer Tools are required if you wish to compile Emacs for yourself. Apple does not install the Developer Tools by default, so you should install them from the media that came with your Mac. Even if you don't plan to compile Emacs or any of the Lisp compilers for yourself, I highly recommend that you install the software anyway. You will need it for SLIME which is best retreived via CVS anyway. Also the developer tools include documentation on OS X.


A bunch of Unix software has been ported to OS X 10.4 Tiger. My favorite source for such software is MacPorts. I installed the aspell spell checker for Emacs from there as well as CLisp, a Common Lisp implementation. I did not setup CLisp with Emacs + SLIME. I am including CLisp on my system simply for completeness. It runs from the command line and using MacPorts is a very simple way to install it. However, using MacPorts goes beyond the current scope of this page, so I will say no more about it.

GNU Emacs

In order to do Lisp development, you need a good editor. For Lisp, there is no better editor than Emacs. You will also want an IDE (Integrated Development Environment). That is provided with the SLIME package that I will discuss below.

There are at least three ways to get a suitable Emacs installed. I can only vouch for the first method because that is what I used.

I am using a very recent CVS version of Emacs from GNU. It is built to use Apple's Carbon API and can be launched from the dock. The CVS version of Emacs is under constant development which means you could check out a broken version. I've not had too many problems with it though. I keep a ~/usr/src/Emacs21_For_Mac_OS_X directory for Emacs. In that directory I have a build-emacs file and an install-emacs file.

Checking out Emacs is as simple enough:

$ cvs -z3 -d:pserver:anonymous@cvs.sv.gnu.org:/sources/emacs login
$ cvs -z3 -d:pserver:anonymous@cvs.sv.gnu.org:/sources/emacs co emacs

Just hit enter at the password prompt. If you have problems, try 'unset CVS_RSH'.

My build-emacs script is simple enough:

cd emacs
make clean
./configure --with-carbon --without-x --prefix=/usr/local
make bootstrap
cd ..

install-emacs. You will want to run this as "sudo sh install-emacs". To do this you will naturally have to enable root user in System Preferences and run visudo as root to add your account name.

cd emacs
make install
echo "Copying Emacs.app to /Applications"
cd /Applications
rm -rf Emacs.app
(cd /Users/david/usr/src/Emacs21_For_Mac_OS_X/emacs/mac; tar cf - Emacs.app) | tar xvf -
chown root:admin Emacs.app
echo "done"

I run the scripts in the usual fashion:

$ sh build-emacs
$ sudo sh install-emacs

I have dragged Emacs over to the dock and launch it from there.


SLIME stands for Superior Lisp Interaction Mode (Extended). It is an Emacs Lisp package that improves on the Emacs Lisp mode. CLiki, a valuable Lisp resource, talks about SLIME here.

To get SLIME from CVS:

cvs -d :pserver:anonymous@common-lisp.net:/project/slime/cvsroot co slime

SLIME is under constant development. It used to be that running the CVS HEAD version was for the more adventurous hacker. Now that is not so much the case. In fact, for SBCL use, you want to have both SBCL and SLIME from the same time period because SBCL developers still make changes to the protocol that SLIME uses to talk to SBCL. I've also seen updates to the OpenMCL backend in CVS. If SLIME is giving you trouble, the first thing to do is make sure you have the latest CVS version.

My ~/.emacs file contains the necessary settings for SLIME to work with both OpenMCL and SBCL. I've also got some other customizations to make Lisp editing easier. I'm bound to make changes over time. This is the version of my .emacs as of 2007-05-11.

;;;; David Steuber's .emacs file for Carbon Emacs (from cvs) on OS X
;;;; Contains stuff stollen from all over the place.
;;;; Much cargo-cult science to be found here!
;;;; Thanks to the following people whom I remember contributed:
;;;;   * Marco Baringer  for key remapping suggestions and, more
;;;;                     importantly, for the spell required to
;;;;                     get Safari to show me the CLHS reference
;;;;                     pages
;;;;   * Trent Buck      for giving me a shorter incantation to
;;;;                     bring up Safari with the CLHS
;;;;   * Taylor Campbell for paredit.el
;;;;   * Bryan O'Connor  for slime configuration help so I can run
;;;;                     OpenMCL and SBCL at the same time
;;;; For those whom I forgot, my apologies.
;;;; Feel free to share!

  ;; custom-set-variables was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.
 '(column-number-mode t)
 '(cua-mode nil nil (cua-base))
 '(display-battery-mode nil)
 '(display-time-mode nil)
 '(global-font-lock-mode t)
 '(indent-tabs-mode nil)
 '(ispell-program-name "/opt/local/bin/aspell")
 '(mac-command-modifier nil)
 '(mac-option-modifier (quote meta))
 '(make-backup-files nil)
 '(show-paren-mode t)
 '(show-paren-style (quote parenthesis))
 '(uniquify-buffer-name-style (quote forward) nil (uniquify)))

;; and disabled hot keys
(put 'downcase-region 'disabled nil)
(put 'upcase-region 'disabled nil)
(put 'erase-buffer 'disabled nil)

;; Other places to find .el files
(add-to-list 'load-path "/Users/david/usr/share/emacs")
(add-to-list 'load-path "/Users/david/usr/src/slime")

;; Load these now instead of relying on autoload
(require 'slime)
(require 'paredit)
(require 'color-theme)

;;; SLIME & Lisp
(setq common-lisp-hyperspec-root
(setq browse-url-browser-function 'browse-url-default-macosx-browser)
(setenv "SBCL_HOME" "/Users/david/usr/lib/sbcl/") ; needed for SBCL
(setq lisp-openmcl  "/Users/david/usr/bin/openmcl64")
(setq lisp-sbcl     "/Users/david/usr/bin/sbcl")
(add-to-list 'Info-default-directory-list "/Users/david/usr/share/info")
;; by registering your implementations, you can choose one by
;; its "short name" when doing M-- M-x slime
(setq slime-lisp-implementations
      '((sbcl   ("/Users/david/usr/bin/sbcl"))  ; default
        (openmcl ("/Users/david/usr/bin/openmcl64"))))
(setq slime-edit-definition-fallback-function 'find-tag)
(setq slime-complete-symbol-function 'slime-fuzzy-complete-symbol)
(slime-setup :autodoc t)
(global-set-key "\C-cs" 'slime-selector)

;; start openmcl with its own inferior-lisp buffer
(defun slime-openmcl ()
  (apply #'slime-start
         (list* :buffer "*inferior-lisp-openmcl*" 
                (slime-lookup-lisp-implementation slime-lisp-implementations

;; sbcl with its own inferior-lisp buffer
(defun slime-sbcl ()
  (apply #'slime-start
         (list* :buffer "*inferior-lisp-sbcl*" 
                (slime-lookup-lisp-implementation slime-lisp-implementations

;;; Macintosh fonts
(set-terminal-coding-system 'iso-8859-1)
(set-face-attribute 'default nil
                    :family "monaco" :height 130)
(setq default-frame-alist '((width  . 116)
                            (height . 42)
                            (top . 0)
                            (left . 0)
                            (tool-bar-lines . 0)))

;; Configure Taylor Campbell's Paredit for Lisp and Emacs Lisp
;; Available from http://mumble.net/~campbell/emacs/paredit.el
(add-hook 'lisp-mode-hook                 'enable-paredit-mode)
(add-hook 'emacs-lisp-mode-hook           'enable-paredit-mode)

;; misc settings
(color-theme-clarity) ; I like this better than dark-laptop.
(add-hook 'text-mode-hook 'turn-on-auto-fill)
  ;; custom-set-faces was added by Custom.
  ;; If you edit it by hand, you could mess it up, so be careful.
  ;; Your init file should contain only one such instance.
  ;; If there is more than one, they won't work right.

I can't promise any of the above will work for you. But it does work for me. You will also have to make the appropriate path adjustments if you do things differently. Rather than just trying to copy and paste the file, just grab a copy from here.

The CVS Emacs distribution does not include color-theme.el. I got that from:


Some Emacs bundlers include it with their bundle. BTW, the Emacs Wiki page is probably worth bookmarking.

Paredit is available from here.

The Common Lisp HyperSpec

The HyperSpec is a valuable reference to the ANSI Common Lisp language. SLIME (and ILISP if you choose to go that way) are able to reference the HyperSpec from inside Emacs for you. You just need to download the HyperSpec and tell Emacs where to find it. You can obtain the HyperSpec here:


Now You Need Lisp


SBCL is probably the most popular free Lisp in current use. If you decide you need help with it and you know how to use IRC, you can easily get help from the #lisp channel on irc.freenode.net. There are actual SBCL maintainers there. Just be sure to use Google and the documentation to exhaust all avenues of finding out how to do something first. FAQs are going to show up somewhere with answers and you don't need to make noise on #lisp for most things. However, if it is evident that you have tried, the people on #lisp can be most helpful.

The quick way to get SBCL installed on your Mac is to go here and follow the instructions. This will get you up and running with SBCL in minutes (depending on your Internet connection speed). If you have no interest in building SBCL yourself, then skip all the way down to OpenMCL and make sure you have the paths in your .emacs set correctly for where you installed SBCL (default is /usr/local).

Building SBCL with SBCL is very easy to do. I use this method to keep up with the monthly patch releases. I got SBCL from CVS initially with the following CVS commands run from ~/usr/src:

$ cvs -z3 -d:pserver:anonymous@sbcl.cvs.sourceforge.net:/cvsroot/sbcl login
$ cvs -z3 -d:pserver:anonymous@sbcl.cvs.sourceforge.net:/cvsroot/sbcl co sbcl

Just hit enter when prompted for the password. Once you have SBCL, you can update it from CVS with 'cvs up -dAP' in the sbcl directory.

There are a couple things you need to do for SBCL to work. The instructions are in the INSTALL file. You have to set an environment variable called SBCL_HOME to point to where the sbcl.core file gets installed. You also need to increase the stack size available with ulimit. I have the following lines in my ~/.profile to make SBCL work:

# the following is needed for SBCL
ulimit -s 8192
export SBCL_HOME=/Users/david/usr/lib/sbcl/

I've also written my own very simple install script called my-install.sh:


export INSTALL_ROOT=/Users/david/usr; sh install.sh;
export SBCL_HOME=/Users/david/usr/lib/sbcl/

Don't forget to make my-install.sh executable with the 'chmod +x my-install.sh' command. Building SBCL is then just a matter of performing the following steps:

$ cd ~/usr/src/sbcl
$ ./make.sh
$ ./my-install.sh


OpenMCL is a great way to go if you have the Intel Core 2 Duo or other 64 bit processor on your Mac. Although still experimental, version 1.1-pre-yyyymmdd snapshots are working 64 bit Lisps for your Mac. No 32 bit version of OpenMCL is available for the Intel. To get OpenMCL, go here and follow the directions. My .emacs file assumes that the openmcl64 script is in ~/usr/bin and that the ccl directory has been properly set up. You can find that in this section of the script:

if [ -z "$CCL_DEFAULT_DIRECTORY" ]; then

That Should Do It!

Assuming all went well, you should now have a fairly good free Lisp implementation and development environment on your Mac. Have fun with it!

I didn't cover any of the commercial implementations. If a commercial Lisp is more to your liking, then check out the top Lisp vendors LispWorks and Franz. I don't use either product, so I can't recommend one over the other (or either over SBCL or OpenMCL for that matter).