Setting up OCaml
Here is a quick overview of how to set up OCaml. In general, the best course of action is to follow the official installation instructions, here. You can also find alternative instructions, here.
In brief, perform the following steps:
For Mac and Linux
- Run
bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh)"in a terminal. Press enter when it asks you where to install it, and enter your password when it asks you to. - Run
opam init; when it asks you how to modifyzsh, just press enter. - Run
opam install ocaml-lsp-server odoc ocamlformat utop. If it says that no switch exists, first runopam switch create cs2800 ocaml-base-compiler.5.3.0. - Try running
utop. If that doesn't work, try first runningeval $(opam env). If it works after runningeval $(opam env), run this command so that you don't have to again:echo 'eval $(opam env)' >> ~/.zshrc. - (Recommended) Install VSCode, search for "OCaml", and install the official OCaml Platform extension.
For Windows
- Install Windows Subsystem for Linux. Open Powershell in administrator mode (right-click on PowerShell and select "Run and administrator"). Then, enter the following command:
wsl --install - Once WSL finishes installing, you can open an Ubuntu terminal via the Start menu.
- Then, follow the instructions for Mac/Linux above.