You have two options for installing OCaml: (1) run a pre-configured Ubuntu VM with everything installed already, or (2) install directly on your machine. If you use Windows, you may find (1) to be easiest. If you use Mac OS X or Linux, (2) should be easy to do on your own.
(1) Pre-configured Ubuntu VM
- Install VirtualBox or some other VM software which supports the Open Virtual Appliance format (.ova).
- Download the pre-configured CS 225 Virtual Appliance, and import it via "File -> Import Appliance".
- The user account in the VM has username "lambda" and the password is a single space " ".
- You may want to mount a shared folder. This will make it easy to move files back and forth between your host machine and the VM. Alternatively, you could set up something like Google Drive or Dropbox to easily sync files between your host machine and the VM.
(2) Install OCaml on your machine
-
Install OPAM. Make
sure after you install OPAM you initialize it with:
> opam init --comp=4.06.0
-
Install the latest version of OCaml (4.06.0) by executing:
> eval `opam config env` > opam switch 4.06.0
-
You will need the following opam packages:
> opam install utop merlin user-setup ppx_deriving
The merlin package is needed for OCaml editor support, utop is a better top-level interpreter than the one that comes with basic OCaml, user-setup makes setting up editor environments easier, and ppx_deriving is an OCaml package that we will use in class. -
Finally, execute this to set up vim and emacs with merlin support:
> opam user-setup install
You may still need to take additional steps to configure your editor.
Merlin install for Vim
- Install Pathogen.
- Install Syntastic.
-
Don't forget to add these lines to your .vimrc, as described in the install
instructions for Syntastic:
set statusline+=%#warningmsg# set statusline+=%{SyntasticStatuslineFlag()} set statusline+=%* let g:syntastic_always_populate_loc_list = 1 let g:syntastic_auto_loc_list = 1 let g:syntastic_check_on_open = 1 let g:syntastic_check_on_wq = 0
-
Add this line to your .vimrc:
let g:syntastic_ocaml_checkers = ['merlin']
Merlin install for Emacs
-
Install tuareg via OPAM:
> opam install tuareg > opam user-setup install
Merlin install for Atom
- Install Atom.
- [Mac only: Make sure you install apm commands by running "Window: Install Shell Commands" from the Command Palette. This is described on the install page.]
-
Install Atom packages which connect to merlin:
> apm install linter-ui-default intentions busy-signal language-ocaml ocaml-indent linter ocaml-merlin
Last updated February 18, 2018