First alpha release of OCaml 5.1.0

Four months after the release of OCaml 5.0.0, the set of new features for the
future version 5.1.0 of OCaml has been frozen. I am thus happy to announce the
first alpha release for OCaml 5.1.0 .

This alpha version is here to help fellow hackers join us early in our bug
hunting and opam ecosystem fixing fun (see below for the installation instructions).
You can see the progress on this front at

OCaml 5.1.0 Release Readiness · Issue #23669 · ocaml/opam-repository · GitHub .

If you find any bugs, please report them here:

Issues · ocaml/ocaml · GitHub

Note that this early alpha version is missing two important fixes for the garbage
collector and Windows support. Those fixes will be available before the beta.
The full release is expected to happen in July.

If you are interested by the ongoing list of new features and bug fixes, the
updated change log for OCaml 5.1.0 is available at:

ocaml/Changes at 5.1 · ocaml/ocaml · GitHub

Installation Instructions

The base compiler can be installed as an opam switch with the following commands
on opam 2.1:

opam update
opam switch create 5.1.0~alpha1

For previous version of opam, the switch creation command line is slightly more verbose:

opam update
opam switch create 5.1.0~alpha1 --repositories=default,beta=git+

If you want to tweak the configuration of the compiler, you can switch to the option variant with:

opam update
opam switch create <switch_name> ocaml-variants.5.1.0~alpha1+options <option_list>

where option_list is a space separated list of ocaml-option-* packages. For instance, for a flambda and no-flat-float-array switch:

opam switch create 5.1.0~alpha1+flambda+nffa ocaml-variants.5.1.0~alpha1+options ocaml-option-flambda ocaml-option-no-flat-float-array

The command line above is slightly more complicated for opam version anterior to 2.1:

opam update
opam switch create <switch_name> --packages=ocaml-variants.5.1.0~alpha1+options,<option_list> --repositories=default,beta=git+

In both cases, all available options can be listed with “opam search ocaml-option”.

The source code for the alpha is also available at these addresses:


Thanks for the release!

Is the new compression feature enabled by default or do I have to specify an option? If so which one?

Compression is enabled by default for the compiler intermediary artifacts (cmi/cmt/cmo/cma files).
More generally, compression is enabled through a new Marshal flag.

1 Like

Ah, yes the size difference is noticeable :slight_smile:

❯ du -sch ~/.opam/5.1.0\~alpha1/lib/ocaml
137M    ~/.opam/5.1.0~alpha1/lib/ocaml
137M    total

❯ du -sch ~/.opam/5.0.0\~beta1/lib/ocaml
222M    ~/.opam/5.0.0~beta1/lib/ocaml
222M    total

This should say space-separated, comma-separated doesn’t work (the example below got it right).

This is fixed now, thanks.