SBCL - how to get started

SBCL is a free or Open Source implementation of Common Lisp. It is probably the most widely used and most active implementation today.

SBCL compiles Lisp to machine language, and can generate machine language that is close to and sometimes faster than similar C or Java code.

SBCL's homepage is here:

Before we start

If you encounter missing configuration files or directories, just create them. For instance if I tell you to edit ~/.pam_environment and it does not exist just create it. We install SBCL in your home folder, this makes it easy to uninstall it or upgrade it later.

This is what we will be installing and/or configuring:

We need Emacs+Slime as a front end to SBCL.


Download SBCL here You probably want the one from the Linux row and the X column (X86).

mkdir -p ~/programming/lisp
cd ~/programming/
tar -xvjf sbcl-1.0.20-x86-linux-binary.tar.bz2
mkdir sbcl-bin
ln -s sbcl-bin sbcl

I create the symlink so I can switch between different versions of SBCL (cvs, cvs+some intresting patch, latest release, old realeses etc.) just by changing the symlink.

cd sbcl-1.0.12-x86-linux
SBCL_HOME= INSTALL_ROOT=~/programming/sbcl-bin sh

Edit ~/.pam_environment and ~/.bashrc and add this to the end of both:

# SBCL-stuff
export SBCL_HOME=~/programming/sbcl/lib/sbcl

Add this to ~/.swank.lisp

(setq swank:*globally-redirect-io* t)

Log out then back in so this will take effect.


Download Slime from CVS, like this:

sudo aptitude install cvs
cd ~/programming/lisp
cvs -d co slime

This will download Slime from CVS. It will be placed in ~/programming/lisp/slime


Install Emacs using the Ubuntu package manager:

sudo aptitude install emacs-snapshot-gtk

Then do the following to configure it (note that this will overwrite your old ~/.emacs file!):

cd ~
touch .emacs-`whoami`

Starting SBCL

Start Emacs, press M-x and type sbcl and press enter. Regular Slime shortcut keys (as mentioned in the Slime manual) will work, and the .emacs configuration file you've downloaded has added some extra keys also.

Feedback: Lars Rune Nøstdal -