Install SBCL + Quicklisp on Ubuntu

This is a short instruction to install Steel Bank Common Lisp (SBCL) and Quicklisp on Ubuntu.

I have tested this with Ubuntu 22.04.1.

Install the Ubuntu packages

You can install SBCL and the Quicklisp installer script via apt:

sudo apt install sbcl sbcl-source sbcl-doc cl-quicklisp rlwrap

I recommend to install sbcl-source, sbcl-doc and rlwrap although they are not necessary.

The sbcl-source and sbcl-doc are useful to read the source code and documentation, which is part of the lisp implementation, offline.

They can be accessed easily from Emacs in combination with SLIME or SLY.

The package rlwrap improves the usage of the sbcl shell command.

It adds a history, as you may know it from bash, for example.

Setup Quicklisp

Start the SBCL REPL with the Quicklisp script loaded (omit rlwrap if it has not been installed):

rlwrap sbcl --load /usr/share/common-lisp/source/quicklisp/quicklisp.lisp

Now execute the following commands in the running REPL:

(quicklisp-quickstart:install)
(ql:add-to-init-file)

And hit ENTER to continue.

The first command downloads and installs Quicklisp to your user directory.

The second command adds some code to your .sbclrc file and creates it if necessary.

This code initializes Quicklisp automatically when SBCL is started.

After these steps you do not have to add the --load command line argument when you start the SBCL REPL.

To test the installation start a new SBCL REPL with "rlwrap sbcl" for example and execute this command:

(ql:system-apropos "web")

This should output some web related Quicklisp packages.

Alternative Quicklisp installer script source

Instead of installing the Ubuntu package cl-quicklisp you can download the Quicklisp installer file from the Quicklisp website.

At the time of writing the version of the website script file is equal to the version of the Ubuntu package script file.

So it does not seem to matter much which source you choose.

Some related links

Steel Bank Common Lisp
Quicklisp
rlwrap
SLIME
SLY