'(Lisp Notes (OS X PowerPC))


This page is no longer maintained. Some links may have rotted away. I am leaving this page up for people who are running OS X on the PowerPC Macs as a service. If you have a new Intel based Mac, please see my new '(Lisp Notes (OS X Intel)) page. Thank you.

My primary Lisp development environment consists of GNU Emacs from CVS, SLIME from CVS, and OpenMCL from CVS. I also use SBCL. What I will attempt to do here is explain the steps you need to take to get up and running with a similar environment. If you haven't already seen it, you should also have a look at my Lisp Development page to see what you can expect.

At this time I am running OS X 10.3.9 on a 12" PowerBook G4.

Important Note!

As of this writing, the Intel powered Macs will not run OpenMCL or SBCL. I do not know about Carbon Emacs and SLIME. If those work, they you can at least run remote Lisp Sessions from your Intel powered Mac.

Hunter Ware sent me a note saying that SBCL will now run on Intel based Macs. Cyrus Harmon has an entry in his blog about it. You just can't keep a dead programming language down!

I will updated this text when I am aware of changes to the situation. In the meantime, stick with G4 and G5 Macs for Lisp programming.

The Apple Developer Tools

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


You will need the developer tools to compile Emacs. Apple does include an old console version of Emacs, but you don't really want to be using that. I'm not sure SLIME even works in it. I will also be describing how to compile OpenMCL (although binaries are available so you don't have to) and SBCL. Xcode also includes a lot of documentation for OS X development.

Fink & Darwin Ports

Fink and Darwin Ports are two projects for porting Unix software to OS X. I use Darwin Ports on my Mac and have installed CLisp from there. It's an old version though and I don't use it much. I will not be discussing either of these projects further except to say that you can get Lisp on your Mac from either of them.


OpenMCL is currently the best free Lisp for developing OS X applications. It sports a pretty decent foreign function interface that includes callbacks necessary for Carbon development. There is also an experimental Cocoa bridge for people who want to go that route. OpenMCL also has working threads. It is pretty easy to put together a proper application bundle if you want to distribute your applications.

This is where you go to get the official OpenMCL distribution. The documentation there is quite good now and will tell you everything you need to know. As of October 5th, 2005, Clozure has released OpenMCL 1.0! I'm still using CVS for updates, but definitely grab the full 1.0 version. If it is close to October 5th when you read this, you might save time using a torrent client and trying this torrent.

When you install OpenMCL you also need to edit the openmcl shell script that is in the scripts directory under ccl. This is so that CCL_DEFAULT_DIRECTORY is set properly. Here is the change I made for my installation:

if [ -z "$CCL_DEFAULT_DIRECTORY" ]; then


SBCL is another free Lisp available for OS X. It is based on CMUCL. It took me several attempts to compile a working version from CVS. That is the nature of building from a constantly updated code base. SBCL is under active development which is a good thing. Once I installed the SBCL that was built with OpenMCL, I recompiled SBCL with that. I now build SBCL under SBCL itself.

SBCL doesn't support threads yet under ppc-darwin (OSX). Still, it is worth looking into. 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

GNU Emacs

I recently found out that Apple has a Carbon Emacs package available for download. Another pre-fabricated Emacs for OS X is Aquamacs. Aquamacs is customized to fit in better with the OS X look and feel. It's probably worth getting one of these rather than building it yourself. I know I have a tendency to try and paste text with M-v which is the standard OS X paste command. In Carbon Emacs, it moves the point up a page. Also a recent update of GNU Emacs has forced me to also update aspell (for spell checking) which I have installed via Darwin Ports, so I had to update that! System administration is so much fun!

I am using the latest development 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.

My build-emacs script is simple enough:

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

Note that I put Emacs into /usr. This replaces the Apple version. You may not want to do that. Feel free to use /usr/local/ or whatever.


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

On my machine, the build takes a while.

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 2006-07-02. Bryan O'Conner sent me a patch to fix up my .emacs for the 2005-10-11 version of SLIME from CVS. Thanks, Bryan!

;;;; 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)
 '(display-battery-mode nil)
 '(display-time-mode nil)
 '(global-font-lock-mode t)
 '(indent-tabs-mode nil)
 '(ispell-program-name "/darwin-ports/bin/aspell")
 '(make-backup-files nil)
 '(show-paren-mode t)
 '(show-paren-style (quote parenthesis))
 '(mac-option-modifier 'meta)
 '(mac-command-modifier nil)
 '(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/openmcl")
(setq lisp-sbcl     "/Users/david/usr/bin/sbcl")
;; by registering your implementations, you can choose one by
;; its "short name" when doing M-- M-x slime
(setq slime-lisp-implementations
      '((openmcl ("/Users/david/usr/bin/openmcl"))  ; default
        (sbcl   ("/Users/david/usr/bin/sbcl"))))
(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)
(define-key paredit-mode-map ")"          'paredit-close-list)
(define-key paredit-mode-map (kbd "M-)")  'paredit-close-list-and-newline)

;; misc settings
(color-theme-clarity) ; I like this better than dark-laptop.
(add-hook 'text-mode-hook 'turn-on-auto-fill)

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.

In an earlier version of this page, I said:

I really should configure my .emacs so that I can run both OpenMCL and SBCL at the same time. It can be done, I just haven't taken the time to set that up.

Well that is now fixed as you can see. I just haven't shaken it all out yet. As I make further refinements, I'll post them 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:



uControl is a very useful utility. It lets you remap your control key to capslock and use your track pad as a scroll wheel among other things. Highly recommended! Note: uControl is not needed for Tiger because Apple incorporated uControl's functions. These are the remappings I did on my PowerBook (there is some order dependency):

  1. control -> alt/option
  2. Capslock -> control
  3. Trackpad as scroll wheel using the fn key

The first remapping gives me a "wider" Meta key for Emacs. I've found that it is a bad idea to use the Apple key for Meta because that won't work on a remote Emacs session running in Terminal over ssh. You don't want the Meta key changing on you! The second remapping puts the control key where it belongs. Just make sure the light is off before the computer goes to sleep. As for the trackpad, well that is useful as a scroll wheel at times.

I think that's it! If everything went according to plan, you should be able to run Emacs from the dock and do M-x slime to start Lisp. Happy hacking!