This guide demonstrates how to install/setup Lua and its related programs for your development environment. Only follow this guide for local installation to either OS X, Ubuntu 16.04, or Bash on Ubuntu on Windows.

1. Install the binaries

You will install OPAM, the package manager for OCaml.

OS X

brew install opam

Ubuntu 16.04

sudo apt-get install opam -y

Windows 10

Get Bash on Ubuntu on Windows using these instructions then follow the Ubuntu guide.

Rice

OCaml and OPAM are already installed with the correct versions on the Rice machines if you followed the Rice setup guide.

2. Install OCaml packages

We use OPAM to manage OCaml packages and install new OCaml versions.

opam init -y
opam switch 4.06.1
eval `opam config env`
opam install core menhir utop merlin ocp-indent user-setup -y

NOTE: If opam switch 4.06.1 doesn’t work and you get a message asking you to run opam switch create 4.06.1 instead, do that.

This step will take a while!

3. Configuring your editor

The most crucial component of the OCaml development toolchain is merlin, a tool that drives many IDE features like getting the types of variables, jumping to symbols, showing syntax errors, and so on. It will make your life much easier, so you really should get it installed.

4. Setup Ocaml env for future startup

Add to your .bashrc (or equivalent)

eval `opam config env`

Vim and Emacs

Configuring Merlin for Vim and Emacs is simple:

opam user-setup install

Anything else

Any other editor (Atom, VSCode, Sublime) requires more work. See the Merlin wiki page for installation instructions.