I want to install last version of ocaml on Ubuntu 16.04 but when I had the PPAs from ocaml website, it displays that there are no release files.

I can't install ocaml of official repositories for they are not up to date.

I follow Ocaml website's tutorial for ubuntu up to date install :

sudo add-apt-repository --yes ppa:avsm/ppa

Imports successfully.

sudo apt-get update -qq


W: The repository 'http://ppa.launchpad.net/avsm/ppa/ubuntu xenial Release' does not have a Release file.
E: Failed to fetch http://ppa.launchpad.net/avsm/ppa/ubuntu/dists/xenial/main/binary-amd64/Packages  404  Not Found
E: Some index files failed to download. They have been ignored, or old ones used instead.

The latest development version of OCaml (4.06) is available at the OCaml GitHub webpage and the Linux installation instructions are at Installing OCaml from sources on a Unix(-like) machine. You should install the build-essential package too with sudo apt install build-essential before you compile ocaml.

There isn't an ocaml package for Ubuntu 16.04 in ppa:avsm/ppa. Probably it's because ocaml is in the default repositories of Ubuntu 16.04.

To install ocaml in all currently supported versions of Ubuntu, open the terminal and type:

sudo apt install ocaml

This will install ocaml version 4.02.3. Upgrading Ubuntu to the latest version Ubuntu 17.04 will give you the same ocaml version 4.02.3 package. The instructions at the official OCaml website for installing OCaml from the PPA are not current beyond Ubuntu 15.10 which is an End of Life version of Ubuntu, so once again the official OCaml website advises sticking with the version of ocaml from the default Ubuntu repositories in Ubuntu 16.04. There isn't an OCaml release for Linux and compatible with Ubuntu 16.04 available from the official OCaml website that is more up-to-date than the same ocaml version 4.02.3 from the official Ubuntu repositories. To get a later version than 4.02.3 in Ubuntu 16.04, you need to install the development version.

  • this is not the last version of ocaml. I already have 4.02 – NanoPish Apr 22 '17 at 15:24
  • So is it impossible to install it on 16.04 ubuntu ? – NanoPish Apr 22 '17 at 15:48
  • You should actually start with 'apt install ocaml opam', then 'opam init' followed by 'opam install utop' etc. That looks like the easiest way of install Ocaml on an Ubuntu system. – Anders Nov 25 '17 at 7:19

I'm running Ubuntu 16.04 on WSL. Like karel said, ocaml is in the default repositories of Ubuntu 16.04, and as she says, this installs ocaml 4.02.x.

In order to install a higher version, install opam and switch the version of ocaml using it.

> sudo apt install opam
> opam switch 4.06.0

I just tried it out. It works fine.


you can install OCaml from source

$ sudo mkdir -p /usr/src/ocaml
$ cd /usr/src/ocaml
$ sudo wget https://caml.inria.fr/pub/distrib/ocaml-4.08/ocaml-4.08.1.tar.gz
$ sudo tar xzvf ocaml-4.08.1.tar.gz --strip-components 1
$ sudo ./configure
$ sudo make world.opt
$ sudo make install
$ sudo make clean

and then install Unison from source, compiled with the freshly installed Ocaml version from above

$ cd /usr/src/
$ sudo git clone https://github.com/bcpierce00/unison.git
$ cd /usr/src/unison
$ sudo make UISTYLE=text

depending on which source you built from, unison should now be installed with the right version, e.g. unison version 2.51.2 (ocaml 4.08.1)

$ unison -version

find more details here: https://github.com/markbil/linux-insights/blob/master/unison_ocaml_installFromSource.md

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.