Installing OCaml for 3110

OCaml logo

These installation instructions assume a basic working knowledge of the “command line” or “terminal”, which is used (e.g.) in CS 1110. If you need to brush up on the command line, it would be a good idea to google for a tutorial.

You need to have a Unix development environment with a working installation of OPAM, the OCaml Package Manager, version 2.x. You have a choice: you can install these on your own operating system, or you can download a Linux virtual machine (VM) that we provide.

Regardless of what 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 2019 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.

Semi-native installation: Windows

Overview: We’re going to install a Linux environment inside Windows 10. Microsoft calls it the “Windows Subsystem for Linux” (WSL). Then we’ll install inside OPAM inside WSL. Here is an (optional) introduction to what WSL is and why you need it.

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

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 (VS 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! You can come to office hours or post on Campuswire. Before posting, please read these tips on asking technical questions.