opam is a source-based package manager. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.
OCaml Shell Makefile M4 Batchfile Python
Latest commit 338418b Jan 19, 2018 @AltGr AltGr Merge pull request #3182 from dra27/fix-appveyor
Fix AppVeyor native builds
Failed to load latest commit information.
admin-scripts Put some order in exit codes, and document them Aug 17, 2017
doc Add a HOWTO rename a package Dec 15, 2017
m4 Support bootstrap compiler in configure Jan 11, 2018
release Add a HOWTO rename a package Dec 15, 2017
shell Add compat for new exception primitives in 4.05 Jan 15, 2018
src Fix PATH lookup for `opam exec` on OCaml 4.06 Jan 18, 2018
src_ext Update src_ext jbuilder to archive with stable checksum Jan 18, 2018
tests Correct jbuild-ignore Jan 11, 2018
.gitattributes Detect Microsoft C Compiler from installation Jan 11, 2018
.gitignore Correct jbuild-ignore Jan 11, 2018
.ocamlinit Add a '.ocamlinit' that runs a toplevel with the current switch loaded Dec 22, 2016
.ocp-indent Make --dry-run a real dry-run, and add --show to check the update Feb 12, 2014
.ocplint Add .ocplint file Apr 14, 2017
.travis-ci.sh CI temporary pin for jbuilder#393 Jan 10, 2018
.travis.yml Cosmetic change to Travis matrix Jan 2, 2018
AUTHORS Add note on OpamVersionCompare (from dose) copyright Apr 10, 2015
CHANGES Bump to beta6 Dec 13, 2017
CONTRIBUTING.md Rename 'OPAM' to lowercase 'opam' everywhere Feb 2, 2017
LICENSE Fix LICENSE file Jun 3, 2016
Makefile Full AppVeyor test matrix Jan 11, 2018
Makefile.config.in Support bootstrap compiler in configure Jan 11, 2018
README.md Add Windows build instructions to README.md Jan 11, 2018
appveyor.patch Fix AppVeyor native builds Jan 19, 2018
appveyor.yml Full AppVeyor test matrix Jan 11, 2018
appveyor_build.cmd Use dra27 jbuilder/ocaml-mccs/flexdll for AppVeyor Jan 11, 2018
appveyor_test.sh Full AppVeyor test matrix Jan 11, 2018
configure Support bootstrap compiler in configure Jan 11, 2018
configure.ac Support bootstrap compiler in configure Jan 11, 2018
jbuild-ignore Correct jbuild-ignore Jan 11, 2018
jbuild-workspace.dev Add jbuilder support Aug 4, 2017
opam-admin.opam Add jbuilder support Aug 4, 2017
opam-client.opam Bump to beta6 Dec 13, 2017
opam-core.opam Bump to beta6 Dec 13, 2017
opam-devel.opam Bump to beta6 Dec 13, 2017
opam-format.opam Bump to beta6 Dec 13, 2017
opam-installer.opam Bump to beta6 Dec 13, 2017
opam-repository.opam Bump to beta6 Dec 13, 2017
opam-solver.opam Bump to beta6 Dec 13, 2017
opam-state.opam Bump to beta6 Dec 13, 2017
opam.opam Add jbuilder support Aug 4, 2017


opam - A package manager for OCaml

TravisCI Build Status AppVeyor Build Status

Opam is a source-based package manager for OCaml. It supports multiple simultaneous compiler installations, flexible package constraints, and a Git-friendly development workflow.

Opam was created and is maintained by OCamlPro.

To get started, checkout the Install and Usage guides.

Compiling this repo

Either from an existing opam installation, use opam pin add opam-devel --dev, or:

  • Make sure you have the required dependencies installed:
    • GNU make
    • OCaml >= 4.02.3 (or see below)
    • The glpk library (or see below)
  • Run ./configure
  • Run make lib-ext as advertised by ./configure if you don't have the dependencies installed. This will locally take care of all OCaml dependencies for you (downloading them, unless you used the inclusive archive we provide for each release).
  • Run make
  • Run make install

This is all you need for installing and using opam, but if you want to use the opam-lib (to work on opam-related tools), you need to link it to installed libraries, rather than use make lib-ext which would cause conflicts. It's easier to already have a working opam installation in this case, so you can do it as a second step.

  • Make sure to have ocamlfind, ocamlgraph, cmdliner >= 0.9.8, cudf >= 0.7, dose3 >= 5, re >= 1.5.0, opam-file-format installed. Or run opam install opam-lib --deps-only if you already have a working instance. Re-run ./configure once done
  • Run make libinstall at the end

Developer mode

If you are developing OPAM, you may enable developer features by including the --enable-developer-mode parameter with ./configure.

Compiling on Native Windows


Cygwin (https://www.cygwin.com/setup-x86_64.exe) is always required to build opam on Windows. Both the 64-bit and 32-bit versions of Cygwin may be used (you can build 32-bit opam using 64-bit Cygwin and vice versa though note that you must be running 64-bit Windows in order to build the 64-bit version).

The following Cygwin packages are required:

  • From Devel - make
  • From Devel - patch (not required if OCaml and all required packages are pre-installed)
  • From Devel - mingw64-i686-gcc-core & mingw64-x86_64-gcc-core (not required if building with MSVC)

Alternatively, having downloaded Cygwin's setup program, Cygwin can be installed using the following command line:

setup-x86_64 --root=C:\cygwin64 --quiet-mode --no-desktop --no-startmenu --packages=make,mingw64-i686-gcc-core,mingw64-x86_64-gcc-core,patch

The --no-desktop and --no-startmenu switches may be omitted in order to create shortcuts on the Desktop and Start Menu respectively. Executed this way, setup will still be interactive, but the packages will have been pre-selected. To make setup fully unattended, choose a mirror URL from https://cygwin.com/mirrors.lst and add the --site switch to the command line (e.g. --site=http://www.mirrorservice.org/sites/sourceware.org/pub/cygwin/).

It is recommended that you set the CYGWIN environment variable to nodosfilewarning winsymlinks:native.

Cygwin is started either from a shortcut or by running:

C:\cygwin64\bin\mintty -

It is recommended that opam be built outside Cygwin's root (so in /cygdrive/c/...). From an elevated Cygwin shell, edit /etc/fstab and ensure that the file's content is exactly:

none /cygdrive cygdrive noacl,binary,posix=0,user 0 0

The change is the addition of the noacl option to the mount instructions for /cygdrive and this stops from Cygwin from attempting to emulate POSIX permissions over NTFS (which can result in strange and unnecessary permissions showing up in Windows Explorer). It is necessary to close and restart all Cygwin terminal windows after changing /etc/fstab.

opam is able to be built without a pre-installed OCaml compiler. For the MSVC ports of OCaml, the Microsoft Windows SDK 7 or later or Microsoft Visual Studio is required (https://www.microsoft.com/en-gb/download/details.aspx?id=8442 - either x86 or x64 may be installed, as appropriate to your system). It is not necessary to modify PATH, INCLUDE or LIB - opam's build system will automatically detect the required changes.

If OCaml is not pre-installed, run:

make compiler [OCAML_PORT=mingw64|mingw|msvc64|msvc|auto]

The OCAML_PORT variable determines which flavour of Windows OCaml is compiled - auto will attempt to guess. As long as gcc is not installed in Cygwin (i.e. the native C compiler for Cygwin), OCAML_PORT does not need to be specified and auto will be assumed.

You can then configure and build opam as above.

Compiling without OCaml

make cold is provided as a facility to compile OCaml, then bootstrap opam. You don't need need to run ./configure in that case, but you may specify CONFIGURE_ARGS if needed, e.g.:

make cold CONFIGURE_ARGS="--prefix ~/local"
make cold-install

NOTE: You'll still need GNU make.

Integrated solver

Having the glpk library and headers installed enables compilation of opam with a built-in solver. Without it, the compiled opam will require an external solver, such as aspcud, at runtime.

You can compile glpk locally and install it to a custom prefix, then run ./configure LIB_PREFIX=custom_prefix. To avoid dynamically depending on it, some options need to be specified at link-time, which can be done through file src/client/linking.sexp. See release/Makefile for examples.

Bug tracker

Have a bug or a feature request ? Please open an issue on our bug-tracker. Please search for existing issues before posting, and include the output of opam config report and any details that may help track down the issue.


User Manual

The main documentation entry point to opam is the user manual, available using opam --help. To get help for a specific command, use opam <command> --help.

Guides and Tutorials

A collection of guides and tutorials is available online. They are generated from the files in doc/pages.

API, Code Documentation and Developer Manual

A more thorough technical document describing opam and specifying the package description format is available in the developer manual. make doc will otherwise make the API documentation available under doc/.


Keep track of development and community news.

  • Have a question that's not a feature request or bug report? Ask on the mailing list.

  • Chat with fellow opamers on IRC. On the irc.freenode.net server, in the #ocaml or the #opam channel.


We welcome contributions ! Please use Github's pull-request mechanism against the master branch of the opam repository. If that's not an option for you, you can use git format-patch and email us.


The release cycle respects Semantic Versioning.

Related repositories

  • ocaml/opam-repository is the official repository for opam packages and compilers. A number of non-official repositories are also available on the interwebs, for instance on Github.
  • opam2web generates a collection of browsable HTML files for a given repository. It is used to generate http://opam.ocaml.org.
  • opam-rt is the regression framework for opam.
  • opam-publish is a tool to facilitate the creation, update and publication of opam packages.

Copyright and license

The version comparison function in src/core/opamVersionCompare.ml is part of the Dose library and Copyright 2011 Ralf Treinen.

All other code is:

Copyright 2012-2016 OCamlPro Copyright 2012 INRIA

All rights reserved. Opam is distributed under the terms of the GNU Lesser General Public License version 2.1, with the special exception on linking described in the file LICENSE.

Opam is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.