Using a Virtual Machine environment

We will provide a virtual machine environment pre-configured for use in the course. This is very likely the easiest solution for Windows users, and is a fine option for Mac users as well.

You can install the VM software from

This course's pre-configured Ubuntu image can be downloaded from the course site. WARNING: it is quite large (2.0GB), so we recommend a wired connection if possible. The image's MD5 hash is bbcfac6b3de9eaff4ccace86e4b79924, if you would like to verify the download integrity.

To run the pre-configured Ubuntu image, use VirtualBox's "Import Appliance" command (from the File menu). Choose "Open appliance..." and select Ubuntu326.ova, which you just downloaded, then click "Import". Importing the image will require approximately 11GB of disk space. Once the image has been imported, you should be able to start the machine. At the login screen, the password for COS326Student is princeton

IMPORTANT: after logging in for the first time (and only the first time), you will have to execute this command in the terminal window in order to use O'Caml version 4:
echo 'eval `opam config env`' >> ~/.bashrc

The remainder of the installation intructions should not be necessary if you are using the VM image, however you may find the discussion about the emacs keyboard shortcuts to be useful.

Installing OCaml

Download and install OCaml. Install the latest release available for your platform.

Windows users, install either the MinGW port or the Cygwin port of OCaml. We use cygwin. Ignore the information on producing standalone Windows executables; you will not need them for this course.

Installing Emacs with Tuareg Mode

You can develop OCaml programs using any text editor. We suggest Emacs with Tuareg mode, a special mode for editing OCaml files. You can find the software and installation instructions on the Tuareg page. From that page, click on released files. Download the latest version. Look at the README and follow the instructions.

Once you have installed OCaml and Emacs, open any file with a .ml or .mli extension. This should start up Tuareg mode and you should see OCaml key-word and comment color highlighting and other features. To start the OCaml top-level interpreter in emacs, on Windows at least, make sure the OCaml bin directory is in your path. At this point, you should be able to type C-c C-s in emacs and the OCaml top-level interpreter will start. Alternatively, you can start OCaml from the Tuareg pull-down menu by choosing "Interactive Mode" and then "Run Caml Toplevel."

Installing the OCaml Plugin for Eclipse

Many of you develop Java programs using Eclipse. There are three OCaml plugins for Eclipse available in various states of development. (There is also a stand-alone OCaml IDE from Brown called Camelia, which we had a lot of trouble with and do not recommend.)

Of the three OCaml plugins for Eclipse, people have had the best luck with OcaIDE. It requires at least Eclipse 3.5 (Galileo), but we recommend upgrading to Eclipse 3.6 (Helios). My sources tell me there were no problems installing it on Ubuntu or on an Intel-based Mac running Mac OS X 10.5 (Leopard) following the online instructions.

Installation and configuration on Windows was a little more painful but ultimately successful. The plugin also requires bash, a Unix command interpreter, which comes with Cygwin, so you may also need to install Cygwin and put C:/cygwin/bin/ on your Windows path.

Real Programmers use Emacs


These OCaml set-up notes come from Cornell's CS 3110, run by Dexter Kozen and Nate Foster.