This tutorial is a complement to the Quick Install tutorial and provides complements on how to install OPAM directly from sources. This is not the recommended way of installing OPAM.
ocaml (at least 3.12.1)
curl or wget
git (optional, to use the git backend)
rsync (optional, to use the rsync backend)
Download the latest stable version of OPAM here.
If you want to try the development (unstable) version of OPAM, clone the git repository:
git clone git://github.com/OCamlPro/opam.git. Please keep in mind that this version may not work as expected.
To compile opam (binaries will be installed in
/usr/local/bin), simply run:
To have OPAM installed in a specific location, please do
./configure --prefix=/the/opam/path make
This will fetch the necessary archives if they are not already downloaded and then build OPAM. If you just want to get the necessary dependencies without compiling the project, run
On *BSD systems, you need to use
gmake instead of
make. Moreover, the default path for installing the manual pages needs to be changed:
./configure --mandir /usr/local/man gmake
To install opam simply run:
sudo make install
OPAM will be installed under
$prefix, that is under
/usr/local if you did not specify a prefix in the configure phase, or whatever location you specified.
Before using OPAM, you need to initialize its state. Start by doing:
opam init eval `opam config env`
Create OPAM configuration files in
Add the default remote repository at URL
http://opam.ocamlpro.comusing opam’s HTTP repository backend.
Update your local environment to be able to use OPAM packages and compilers.
It is recommanded that you add
eval `opam config env` in the configuration file of your shell (most likely
To learn more about these two commands, try
opam init --help and
opam config --help.
To uninstall OPAM, simply run:
$ make uninstall
at the root of the sources. Or you can simply remove OPAM binaries, manual pages and state:
$ rm -rf $(opam config var root) $ rm -f $(which opam) $(which opam-admin)