Installing OCaml for 3110

OCaml logo

You need to have a working installation of OPAM, the OCaml Package Manager, version 1.2.2. You have a choice: you can install OPAM natively on your own operating system, or you can download a Unix virtual machine (VM) that we provide in which OPAM is already installed.

Regardless of which you choose, once you get an installation working keep it working throughout the semester by being cautious about any updates you apply to your system. Don’t perform any major OS upgrades just before an assignment is due, for example.

Click on the installation method below that you want to use. If you get stuck, please follow the instructions under “Need help?”.

VM installation

WARNING: Do not use a VM from an old edition of CS 3110. Only the Fall 2018 VM will be supported this semester.

With Virtual Machines, there are two operating systems involved: the host operating system (OS) and the guest OS. The host is your own native OS (probably Windows). The guest is the OS that runs “inside” the host. We provide a Linux guest OS in the 3110 VM.

Native installation: OS/X

You need a Unix package manager. There are two popular managers on Mac, MacPorts and Homebrew. The instructions below assume MacPorts. Whatever you do, do not install both. They do not play nicely together.

If you previously installed one of them, make sure it is in working order and fully up-to-date before proceeding. With MacPorts, that means running sudo port selfupdate followed by sudo port upgrade outdated. If there are any errors, you need to resolve them before proceeding. Often the easiest way to do that is to uninstall the package manager then reinstall it from scratch.

If you’re starting from scratch, here’s what to do:

Native installation: Linux

Semi-native installation: Windows

Dual-boot installation: Windows and Linux

If your hardware is not powerful enough to run the VM inside Windows without significant lag, you could consider dual-booting Windows and Linux. (We recommend Ubuntu 18.04, because that’s what the VM is based on, but you could choose another Linux distribution.) There are many guides you could find online for how to do that, but this is getting into territory that we are unable to support. You should certainly make a backup of your entire Windows system before attempting to get dual-booting working, just in case something goes wrong. If you do get it working, you can follow the instructions above for a native installation on Linux.

OPAM configuration

You do not need to follow these instructions if you are using the VM. We have already done them for you.

VS Code configuration

You do not need to follow these instructions if you are using the VM. We have already done them for you.

The Visual Studio Code editor is our current recommendation for the best OCaml experience in a modern editor. After installing OPAM, and after installing VS Code, you’ll need to install some packages inside the editor itself.

Need help?

The course staff is happy to help you out with any trouble you might have. We ask that you come visit a consultant during office hours for that help, because it is far more efficient to provide this kind of technical support in person. Please refrain from posting on Piazza, which creates noise that other students will be forced to filter out.