Install Ocaml
run sh <(curl -sL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh)
and install opam at /usr/bin
(Caution: install it under this directory to ensure you can also access opam at user’s directory)
Configure Ocaml and VSCode
initiate with sandbox (bubblewrap) disabled
opam init --bare -a -y --disable-sandboxing
switch OPAM to the OCaml 4.09.0 compiler:
1
2
3# Note: do NOT prefix these commands with sudo
opam switch create 4.09.0 ocaml-base-compiler.4.09.0
eval $(opam env)install OPAM packages needed
1
2opam install -y utop ounit qtest yojson lwt lwt_ppx menhir ansiterminal lambda-term merlin ocp-indent user-setup bisect_ppx-ocamlbuild
opam user-setup installinstall “OCaml and Reason IDE” and configure
settings.json
in vscode as such:1
2
3
4
5
6
7
8
9
10{
"workbench.colorTheme": "Solarized Light",
"editor.tabSize": 2,
"editor.rulers": [
80
],
"editor.formatOnSave": true,
"reason.path.ocamlmerlin": "/home/mint/.opam/4.09.0/bin/ocamlmerlin",
"reason.path.ocamlfind": "/home/mint/.opam/4.09.0/bin/ocamlfind"
}note that it first showed that “cannot locate ocamlmerlin binary.” I fixed the problem by changing directory of “ocamlmerlin” and “ocamlfind” in the settings. (Find their path with
which ocamlmerlin
)