Getting going with modern Common Lisp on Linux
Download and install SBCL (http://www.sbcl.org/)
Download and install Emacs (http://www.gnu.org/software/emacs/)
Download and install Quicklisp (http://www.quicklisp.org/)
Configure everything so that it plays nice together.
I’m doing this under Ubuntu 10.04, but I’m only using the package manager for Emacs so this should translate well across multiple distributions.
Download and install SBCL
SBCL is probably the most popular Common Lisp implementation available for Linux. There are other great ones out there (Clozure CL and CLISP come to mind), but SBCL’s the one I usually use.
Go to SBCL’s download page and download the latest release for Linux. (Both 32-bit and 64-bit work great).
Now fire up a terminal, switch to where you downloaded SBCL, unpack and install it:
That’ll install SBCL into /usr/local/bin. At this point you should be able to run ‘sbcl’ and get a Lisp prompt:
Hit Control-D or type
(quit) to exit.
Use your package manager for this. On Ubuntu:
Download and install Quicklisp
Download Quicklisp from http://www.quicklisp.org/. (It’s in beta at the time this was written, but it’s fully functional and awesome). Download the install file and save it to disk somewhere easy to find.
Next, run sbcl and type in the following:
After it loads, run:
That’ll download the rest of the system and get it set up for you. Quicklisp
will install by default in
~/quicklisp; you can change that by passing
"/target/path/" to the install function.
That’ll add Quicklisp to your init file so that anytime you run SBCL Quicklisp will be loaded and ready to go.
Now go ahead and read on http://www.quicklisp.org/ about how to use it. It’s very easy to search for and install Common Lisp libraries. For example, to get ahold of “ieee-floats” for the previous entry, just run:
That will download the library if it hasn’t already and load it into your CL environment for you.
Configure everything so that it plays nice together
SBCL and Quicklisp are already playing nicely together at this point; you just need to let Emacs know about them.
First in SBCL run:
This’ll install SLIME for you, an
awesome Common Lisp development environment. It should give you a line to add
.emacs configuration file:
You’ll need to both add that line and tell Emacs how to launch your Lisp
environment. To do that, add the following to
At this point, you should be ready to go. To try it all out, launch Emacs, type Alt-x (Meta-x, technically), and type in “slime”. Hit enter and you should find yourself at a CL-USER prompt within Emacs.
Now, actually learning to use SLIME is well beyond the scope of this entry. For that, I recommend Peter Seibel’s Practical Common Lisp. Chapter 2 covers getting around both in Emacs and SLIME.