Installation of package manager
brew install gpatch
brew install opam
Installation of Ocaml
# environment setup
opam init
# put the shel in the right step
eval $(opam env)
# install given version of the compiler
opam switch create 4.12.0
eval $(opam env)
# check you got what you want
which ocaml
ocaml -version
So now you can start a repl and play around it
ocaml
let rec fib n =
if n < 2 then n else fib (n - 1) + fib (n - 2);;
How to solve problems with opam?
On Linux and macOS, this will be the ~/.opam directory, which means you don't need administrative privileges to configure it. If you run into problems configuring opam, just delete the whole ~/.opam directory and start over.
Top comments (0)