I’ve been a Lisp nut for years. I was first exposed to Lisp on my TRS-80, when I was about thirteen; Randy Beer had written a Lisp introduction in the March ’83 issue of 80 Micro, and I remember reading it again and again. I’ve used various flavors of Lisp for exploratory prototyping programming over the years, and have enjoyed using both Scheme and Common Lisp. php
Getting a dialect of Common Lisp running on Mac OS X isn’t hard — in fact, if you’re just setting out, an excellent choice is LispWorks Personal Edition. I’ve recently gotten to the point, however, where I’ve wanted to do some work with the Common Lisp Interface Manager, which isn’t supported in LispWorks Personal Edition under Mac OS X, and set out to configure a Common Lisp installation on my MacBook from the ground up. html
It wasn’t difficult, although it took some Googling to get all the pieces together; shortly after I finished, someone on the Bay Area Functional Programmer‘s mailing list asked about running Common Lisp on Mac OS X, and I put together my notes on the topic and replied. The list is fairly small — less than 300 members — and I promised them and myself that I’d organize the notes and provide them in a more accessible location. linux
What follows is a step-by-step installation guide to installing Steel Bank Common Lisp (SBCL) andMcCLIM on a PowerBook G4; I undertook this from the initial notes I took configuring the MacBook. I chose SBCL because it’s well-supported by the open source community and works well with McCLIM; I have nothing against other Common Lisp implementations, including Clozure. shell
A word of warning is in order: I’m comfortable with Common Lisp, but relatively unfamiliar with how Common Lisp programmers handle package distribution. I get the basic idea behind ASDF, of course, but I’m not seasoned in its use. Consequently, I had a get-things-working-and-clean-up-later mentality when I undertook my first SBCL-McCLIM configuration, and this largely remained when I wrote what follows. Other Lisp developers may have better ways to organize their working environments, and I’d welcome positive comments (drop me an email, and we’ll figure out how to incorporate your feedback). promise
Starting out, you should have a relatively up-to-date Mac OS X box (I’ve done this on Mac OS X 10.4.x and 10.5.x systems). When you’re done, you will have installed Carbon Emacs, SLIME, SBCL, andMcCLIM configured to work with the X Windows server Mac OS X provides, along with darcs. app
Carbon Emacs on Mac OS X provides you with an Emacs instance running as a Mac OS X application. I like it for general editing, as well as the obvious purpose of giving me a place to run SLIME and do my Lisp development. less
KF6GPEs-PB-G4:~/Desktop/sbcl-1.0.2-powerpc-darwin kf6gpe$ sudo sh Password: <entered password> # INSTALL_ROOT=/usr/local sh install.sh
At this point in time, you should be able to run SBCL from the shell. curl
SLIME in Carbon Emacs is swell. ide
KF6GPEs-PB-G4:~ kf6gpe$ cvs -d :pserver:anonymous:anonymous@common-lisp.net:/project/slime/cvsroot co slime KF6GPEs-PB-G4:~ kf6gpe$ mv slime ~/.slime
(setq inferior-lisp-program "/usr/local/bin/sbcl") (add-to-list 'load-path "~/.slime") (require 'slime) (slime-setup)
where
/usr/local/bin/sbcl is the path to SBCL you specified in the previous section, and
~/.slime is the path to the slime directory you specified in the previous step. post
You can stop at this point if you don’t want to work with McCLIM; you have a working SBCL
environment using Carbon Emacs and SLIME. To use SLIME, start emacs from the Terminal or
Carbon Emacs and run SLIME using M-x slime.
Some of the stuff you need for McCLIM is kept in a darcs repository, so you first need to get and install darcs. I used one of the pre-built binaries. Make sure that however you do this, darcs is in your path when you’re done installing, of course.
Â
I followed these steps  to build and configure McCLIM from source.
(require 'asdf) (push (truename "~/lispsystems") asdf:*central-registry*)
KF6GPEs-PB-G4:~/lispsystems kf6gpe$ cvs -z3 -d:pserver:anonymous:anonymous@common-lisp.net:/project/mcclim/cvsroot co mcclim KF6GPEs-PB-G4:~/lispsystems kf6gpe$ ln -s mcclim/mcclim.asd . KF6GPEs-PB-G4:~/lispsystems kf6gpe$ ln -s mcclim/clim-examples.asd .
KF6GPEs-PB-G4:~/lispsystems kf6gpe$ darcs get http://common-lisp.net/~crhodes/clx KF6GPEs-PB-G4:~/lispsystems kf6gpe$ ln -s clx/clx.asd . KF6GPEs-PB-G4:~/lispsystems kf6gpe$ curl http://ftp.linux.org.uk/pub/lisp/cclan/spatial-trees.tar.gz > spatial-trees.tar.gz KF6GPEs-PB-G4:~/lispsystems kf6gpe$ tar -xvzf spatial-trees.tar.gz KF6GPEs-PB-G4:~/lispsystems kf6gpe$ curl http://common-lisp.net/project/flexichain/download/flexichain_latest.tgz > flexichain_latest.tgz KF6GPEs-PB-G4:~/lispsystems kf6gpe$ tar -xvzf flexichain_latest.tgz KF6GPEs-PB-G4:~/lispsystems kf6gpe$ ln -s spatial-trees-0.2/spatial-trees.asd . KF6GPEs-PB-G4:~/lispsystems kf6gpe$ ln -s flexichain_1.5.1/flexichain.asd .
CL-USER> (asdf:oos 'asdf:load-op :mcclim)
Be prepared to wait a while as the system builds for the first time.Â
CL-USER> (asdf:oos 'asdf:load-op :clim-examples)
CL-USER> (clim-demo::run-test 'clim-demo::demodemo)
You also have the option of getting McCLIM using clbuild, as this page describes. That worked for me under Mac OS X 10.5, but did not under Mac OS X 10.4, and I didn’t bother to investigate what was different.Â
Good luck and happy hacking!
Written by kf6gpe
September 19th, 2008 at 1:18 pm
Posted in Programming
Tagged with Lisp
Subscribe to comments with RSS or TrackBack to 'Using Common Lisp on Mac OS X'.
[...] Using Common Lisp on Mac OS X at Ray Rischpater’s BlogSep 19, 2008 … I chose SBCL because it’s well-supported by the open source … KF6GPEs-PB-G4 :~/lispsystems kf6gpe$ ln -s mcclim/clim-examples.asd . … [...]
28 Sep 11 at 10:29 am
from: http://www.lothlorien.com/kf6gpe/?p=24