Archive | 2:12 pm

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)
Advertisements

A little bit of Ubuntu Linux knowledge

13 Nov

I own a copy of VMware Fusion 2, and have installed Ubuntu Linux 8.04 LTS on it in a virtual machine. I know how to keep it up-to-date with the menu system, but I didn’t know how to do it using the command prompt, though I probably complicated matters more than necessary, because I’m sure the answer is on the Ubuntu wiki.

Now I will try to tell you how I arrived at this bit of knowledge about Ubuntu, in a somewhat convoluted way.

I was looking how to install Squeak on a remote server, in case I want to run my own Seaside web service one day. By searching with Google I found out that it is not called “installing Squeak”, but “deploying Squeak” –who would have thunk?

Anyway, while googling and surfing I came across this fine article by Ramon Leon, called Scaling Seaside Redux: Enter the Penguin. In this article Ramon explains how to install Ubuntu linux server (or any Debian server) on a local box, i.e. a computer you can touch with your hands. Furthermore, he describes how to update and upgrade the linux OS, and install the necessary applications on it.

To install Seaside on a virtual server (that seems to be the terminology, instead of remote server), I found this article by Peter Osburg, called Deploying Squeak on a virtual server with Linux. This is probably what I will need in the future, because a hosting provider has a much better connection to the Internet than I could ever hope to have as a consumer.

Of course, I will read both articles (and probably many more) when I have a need for it. Currently, I can’t even program in Squeak, let alone write an app in Seaside. Nevertheless, I took away a nugget of knowledge from all this.

It seems that you can make your copy of the Ubuntu (or any Debian linux distro) up-to-date with two terminal commands, instead of through the menu system:

sudo apt-get update
sudo apt-get upgrade

Of course, for this to work, you need to be logged in as an administrator, and type in your administrative password at the command prompt. Mind you, you will get no visual feedback for that password. In other words, you will not see the usual asterisks while typing characters with your keyboard. This is a bit awkward if you’re used to the GUI way of entering your credentials (GUI stands for graphical user interface).

A server has no GUI, so you can’t use it to keep your machine up-to-date. In that case, you will need the command line interface, instead of the graphical user interface. The desktop version of Ubuntu has both.

That is all.