Installing OCaml



i just wanted to raise this point
on the two most popular operating systems/distribution

it is kind of hard to get the latest or a recent release of OCaml

on ubuntu 18, you get ocaml 4.05
and on windows you get ocaml 4.03

is there an easy way to install the latest ocaml on both platforms, that is not well advertised, or one that i am not aware of

i think it is very important to have ocaml binaries both 32 and 64 bit for windows and ubuntu


I don’t use windows but on any unix like system you can use opam to install any version of OCaml that has been published.

  • With opam 1.2: opam switch 4.06.1
  • With opam 2: opam switch create 4.06.1


Just to be clear: once you have any version of OCaml running on your Linux box, you can use opam to manage your packages, including your compiler package. This is the preferred way to deal with OCaml packages. You can then install 4.06.1 with it, or the flambda variant of the compiler, or anything else you like.

If you want the default on Ubuntu to be a more recent OCaml, then I recommend talking to whomever manages the OCaml packages for Ubuntu, which is an Ubuntu rather than an OCaml thing as such.


For ubuntu this is as simple as

sudo apt install opam
opam init
opam switch 4.06.1

And following the instructions