Tag Archives: scheme

Installing MIT/GNU Scheme on Mac OS X Leopard

13 Nov

If you want to learn proper program design (and have the time to do so), you should read and do How To Design Programs. With this free MIT course, you only deal with high level concepts and don’t get bogged down by low level details, as you are with C. However, you still need a form of Lisp installed on your computer to do the exercises from the book. I think the best software companion with the book for Mac OS X 10.5 Leopard is MIT/GNU Scheme.

This article describes how to install MIT/GNU Scheme on your own Mac. If you’re not the owner of your Mac (because you share it with someone else). then have a look at the Unix Installation notes on the MIT/GNU Scheme download page. This article assumes you have access to administrative privileges on your Mac computer.

0. Remove any existing installations

Open a Terminal window (Terminal is an application located in “/Applications/Utilities/”) and type:

which scheme

If you get no reply, scheme hasn’t been installed on your system and you’re done with this step, after closing the Terminal window.

If you see a response, type this line into the Terminal window:

echo $MITSCHEME_LIBRARY_PATH

If you don’t get a response, you’re good to go. The library is probably somewhere on your system, but it shouldn’t get in your way. If you want, you could hunt it down and delete the folder, but that is beyond the scope of this article. Close the Terminal window and go to step 1.

On the other hand, if you got a response, copy the text, by selecting it, and pressing Command-C on your keybaord. Next, open a new Finder window, press Shift-Command-G, paste the previously copied text into the text box (Command-V), and press the Enter key to confirm. Now drag the mit-scheme folder into the trash can, and, if you’re asked for it, supply your admin username and password to confirm. Close both the Terminal and Finder window.

1. Download the software

First go to the MIT/GNU download page, and download the Mac OS X binary, for the X86 architecture (compiled as native code on Mac OS X 10.5). Unzip/untar the archive and locate the two folders, called bin and lib, inside the mit-scheme-20080130-ix86-apple-darwin/bin/ folder.

2. Install the bin folder

Open a new Finder window. Locate the /bin/ folder. Drag the items in the mit-scheme-20080130-ix86-apple-darwin/bin/ folder into the /bin/ folder, and supply your admin username and password.

3. Install the lib folder *

Select the Finder window showing the contents of /bin/ and go to the /usr/lib/ folder, using Shift-Command-G. Drag the mit-scheme subfolder in the mit-scheme-20080130-ix86-apple-darwin/lib/ folder into the /usr/lib/ folder, and supply your admin username and password. Close both Finder windows.

4. Adjust your shell profile *

Next, open a new Terminal window, and type:

pico .profile

This will edit your shell profile. At the bottom add this line of code (or replace it, if there already is a similar line):

export MITSCHEME_LIBRARY_PATH=/usr/lib/mit-scheme

This will tell MIT/GNU Scheme where to find the library files on your system. Press Ctrl-O to output the file, and Ctrl-X to exit pico. Close the Terminal window.

5. Test your installation

To test your installation, open a new Terminal window (by pressing on the Terminal application in the Dock). Now enter:

scheme

in the Terminal window, and you should see a welcome screen. To exit, press Ctrl-C first, and then a capital Q. You can now quit the Terminal application.

That is all.

* According to reader bryogenic /usr/lib should be /usr/local/lib
(September 18, 2009)