Install OPAM in 2 minutes

This page describes how to install and configure OPAM. For further help on how to use OPAM, either read opam --help or move on to the Basic Usage guide.

Installing OPAM with your distribution

You can use the OPAM package of your distribution if available. Here is a list of supported distributions:


The opam and opam-git packages are available in the AUR. Replace opam with opam-git in the following instruction to get the development version:

yaourt -S opam

Ubuntu (Precise and upwards)

add-apt-repository ppa:avsm/ppa
apt-get update
apt-get install ocaml opam

There are also PPAs available that are pinned to specific revisions of OCaml and OPAM to help with automated testing.


Binary packages of OPAM 1.1.0 are available for the testing and unstable distributions. OPAM 1.1.1 Shoud be available shortly, see here for the latest. Wheezy users are left with the options of compiling from source, pinning the packages from the testing repository, requesting a backport from Debian, or using our binary installer below.


The opam package for Mageia can be installed with the command:

urpmi opam


OPAM packages for homebrew and MacPorts are available:

brew install opam                   # using Homebrew on OSX Mavericks
brew install opam --without-aspcud  # using Homebrew on OSX Mountain Lion (or lower)
port install opam                   # using MacPort

See also howto setup for opam usage.

Binary installer

Pre-compiled versions for most common architectures and OSes are available on the Github "releases" page. We also provide a very simple installer script that will automatically download the right version for you, put it in your binary directory and initialize it.

sh ./ /usr/local/bin

You can also specify which version of OCaml you want to install:

sh ./ /usr/local/bin 3.12.1 # Install the latest OPAM and OCaml 3.12.1
sh ./ /usr/local/bin system # Install the latest OPAM using the system compiler (if any)

From Sources

Getting the Sources

Sources of the latest stable version of OPAM are available on Github. You can also download the full archives, including OPAM dependencies:

  • 1.1.1 MD5 (opam-full-1.1.1.tar.gz) = a7bebe947b3e6c1c10ccafabb839d374

  • 1.1.0 MD5 (opam-full-1.1.0.tar.gz) = d6e2f56b10c0be73b5677963e6659d24

Once the archive downloaded and extracted, you can then run the usual commands:

./configure && make && make install

See Advanced Install guide for more information.

Using ocamlbrew

ocamlbrew is a script that can bootstrap an OCaml environment including OPAM, from source. This option does not require an existing OCaml installation, or a pre-compiled OPAM binary for your platform. To bootstrap a new OCaml environment including OPAM, make sure that you have the necessary pre-requisites installed to run ocamlbrew, and then run:

curl -kL | env OCAMLBREW_FLAGS="-r" bash