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)
About these ads

4 Responses to “Installing MIT/GNU Scheme on Mac OS X Leopard”

  1. Don Noah Lotts November 22, 2008 at 5:55 pm #

    Thanks for the great post! I don’t have a clue about programming though I’m very interested, and this is a great handholding description of how to get started. I have a question, though. On the “How to Design Programs” page it shows a link to something called PLT Scheme. Do you recommend using the MIT/GNU scheme or the PLT scheme, or no difference? Thanks again!

  2. Rene November 22, 2008 at 6:23 pm #

    Both can be used, though the syntax is somewhat different for PLT Scheme. PLT Scheme is included with DrScheme, which has a nice UI and a somewhat smoother learning curve. See http://www.drscheme.org/ However, DrScheme is geared towards a younger audience, especially the assignments in the tutorials.

    Mind you, I’m not a programmer (software developer), just an enthusiast.

  3. Arshad Munir March 26, 2009 at 10:35 pm #

    Hi,
    Tried to install schme following the steps but got an error at last.
    Can you help me with this.

    scheme: can’t find a readable default for option –band.
    searched for file all.com in these directories:
    /usr/local/lib/mit-scheme

    Inconsistency detected.
    Regards

  4. Rene March 27, 2009 at 9:20 am #

    Alas, I can’t help you there. If someone else can answer this question, please feel free to do so. Just post a comment and I will relay your solution to Arshad Munir.

    I got a comment from bryogenic on September 18, 2009:

    /mit-scheme needs to be moved to /usr/local/lib/ not /usr/lib/

Comments are closed.

Follow

Get every new post delivered to your Inbox.

%d bloggers like this: