opam

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

Subscribe to updates I use opam


Statistics on opam

Number of watchers on Github 627
Number of open issues 158
Average time to close an issue 3 days
Main language OCaml
Average time to merge a PR 1 day
Open pull requests 54+
Closed pull requests 27+
Last commit 5 months ago
Repo Created over 6 years ago
Repo Last Updated 4 months ago
Size 30.6 MB
Homepage https://opam.ocam...
Organization / Authorocaml
Latest Release1.2.2
Contributors61
Page Updated
Do you use opam? Leave a review!
View open issues (158)
View opam activity
View TODOs for opam (8)
View on github
Latest Open Source Launches
Trendy new open source projects in your inbox! View examples

Subscribe to our mailing list

Evaluating opam for your project? Score Explanation
Commits Score (?)
Issues & PR Score (?)

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)
    • A C++ compiler (unless building without a solver, see ./configure --without-mccs)
  • 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

BUILDING ON WINDOWS IS A WORK-IN-PROGRESS AND THESE INSTRUCTIONS WILL EVOLVE!

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 Interpreters - m4 (unless required packages are pre-installed or built using make lib-ext rather than make lib-pkg - m4 is required by findlib's build system)
  • 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,m4,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. Once the compiler is built, you may run:

make lib-pkg

to install the dependencies as findlib packages to the compiler. Building lib-pkg requires the ability to create native symbolic links (and the CYGWIN variable must include winsymlinks:native) - this means that either Cygwin must be run elevated from an account with administrative privileges or your user account must be granted the SeCreateSymbolicLinkPrivilege either by enabling Developer mode on Windows 10, or using Local Security Policy on earlier versions of Windows. Alternatively, you may run configure and use make lib-ext, as advised.

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.

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.

Documentation

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/.

Community

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.

Contributing

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.

Versioning

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.

opam open issues Ask a question     (View All Issues)
  • over 1 year OPAM 2.0 & variable OPAMKEEPBUILDDIR
  • over 1 year Typo in Opam FAQ: correct: "opam-depext" wrong: "opam depext"
  • over 1 year Broken link and github tag for 4.04.0
  • over 1 year gpgsign=true in .gitconfig is breaking opam repo add
  • over 1 year gsl incompatible with camlp4
  • over 1 year building opam from source on Alpine Linux
  • almost 2 years on freebsd: set owner/group (was: 1001/0): Operation not perimtted
  • almost 2 years Reproducible builds
  • almost 2 years "Sorry, no solution found: (...)", but no further information from OPAM
  • almost 2 years [Documentation][2.0] Need more info about adding new compiler
  • almost 2 years opam behavior when disk is full
  • almost 2 years Error: Port opam not found
  • almost 2 years Should /usr/local should be included in the compiler CFLAGS on osx?
  • almost 2 years Could not update repository `default` for opam 2.0~beta
  • almost 2 years opam silently drops all dependencies when an undefined variable is encountered
  • almost 2 years Document opam-lib use-cases before OPAM2
  • almost 2 years maintainer information
  • almost 2 years Overly enthusiastic conflict message
  • almost 2 years OPAM does not compile with recent version of OCaml
  • almost 2 years OpamStd dependency-free opam file format parser
  • almost 2 years add a `compiler-bundle:` field
  • almost 2 years Add hooks for validation of repository updates
  • almost 2 years opam or OPAM ?
  • almost 2 years Unix.lockf may fail on some platforms (e.g. Hurd)
  • almost 2 years Options to navigate versions of a package.
  • about 2 years `~/.gitconfig` configuration option breaking opam git backend
  • about 2 years Feature: rename opam switches
  • about 2 years documentation clarification plus feature request for testing local opam-repository changes
  • about 2 years Replace absolute path of OPAMROOT in config files by a variable
  • about 2 years Tracking wishlist issue for opam 2.0
opam open pull requests (View All Pulls)
  • Unit tests
  • Minor simplification in OpamState.
  • Removals last (don't merge yet!)
  • Improve error message
  • Feature/mini repo
  • Adhering to SPDX standard for licence naming
  • new functionality to opam lint to detect redundant dependencies / conflicts
  • Refine maintainer warning in Opamfile.validate
  • add support for displaying active switch in prompt
  • Set OPAM_COLUMNS to force the formatting line length
  • Add automatic fallbacks using backup-urls
  • Add a lint check on unclosed variables
  • Document test dependencies
  • Minor typos and suggestions to Packaging.md
  • Update src_ext dependencies
  • add back pef/opam export functions
  • Next
  • AppVeyor: print opam config env at end of compilation
  • Update the sub-lib packages
  • Define OPAM_SWITCH_PREFIX when running package commands
  • Update src_ext dependencies
  • next: add package subcommand
  • next: add local subcommand
  • For external plugin search, always do a full PATH search
  • Dose3.5.0 rc1
  • Delay removal of packages as much as possible.
  • Dose3.5.0
  • [experimental] try a more consistent setup without global 'ocaml-version'
  • Add pre/post & switch wrappers
  • Fix bug in removals-last that could lead to cyclic actions
  • Add --inplace-build
  • Experiment: Unquote package names in opam files
  • Experiment: don't remove extra parens when printing opam files
  • [WIP] add the Conex hooks
  • Add prototype 'opam build' command
  • Some fixes and UI improvements
  • %<...>% path expansion notation
  • Added alternate way to get opam_installer.sh
  • Update Ubuntu install instructions
  • Fix configuration and build system for native Windows
  • lib-ext improvements
  • Developer tweaks
  • Support make distclean at toplevel
  • Switch defaults configuration file
  • No longer set OPAMROOT or OPAMSWITCH automatically as part or 'opam env'
  • lib-pkg alternative to lib-ext
  • Update README with C++ compiler information
  • RFC: allow recursive lookup of opam files for `opam pin .`
  • [WIP] Move most of the external tools calls to a single module
  • Pass fd to functions in OpamFilename.with_flock*
  • Fixes the version parsing starting with 'v' for pinning.
  • C stubs for native Windows support
  • Update re to 1.7.2
  • Update to dune18!
opam questions on Stackoverflow (View All Questions)
  • How to get "opam init --comp=..." to install at the latest OCaml version?
  • OPAM "Illegal Instruction: 4" for Infer Static Analyzer
  • using the uint package with OCaml - opam
  • Packages of OPAM remote can be searched but not installed
  • Oracle OPAM REST API checkout method returns an http 409 code
  • problems occurred when installing slap package by using opam in ocaml
  • How to list current package versions in OPAM?
  • Compiling ocaml can't find module in opam library, Js.ml in js_from_ocaml
  • opam fails trying to install lwt looking for pthreads
  • Cygwin & OCaml: OPAM + Batteries
  • Switch environment in OPAM
  • Opam says upgrade is not possible
  • coq Hello World example (with opam) can't find libraries
  • What is the use of eval `opam config env`?
  • In Opam how do I tell which package owns a given file?
  • How to make library installed from OPAM available to OCaml?
  • OPAM: how to locally reinstall a package without re-downloading it?
  • Uninstall binary file when removing OPAM package
  • Installation of camlp4 with opam on OS X 10.9 failed
  • Sedlex installed by opam but not found by ocamlfind
  • making OPAM work with system compiler under MacOS X
  • Basic Oasis or Opam file for a simple OCaml project
  • How do I install OPAM package documentation?
  • Using Opam to manage project dependencies
  • opam report config file is missing
  • Installing OPAM System-Wide?
  • not able to install anything using opam
  • Specifying prefix in opam file
  • Is it possible to make an opam "sandbox"?
  • How can I use ocamlbrowser with opam packages?
opam list of languages used
opam latest release notes
2.0.0-rc 2.0.0~rc

Release candidate for 2.0.0

2.0.0-beta6 2.0.0~beta6

Small fixes over beta5

2.0.0-beta5 2.0.0~beta5

This new beta brings many usability improvements and fixes. Most notably:

  • A new, clearer and more expressive format for depexts:. Opam can now directly extract them for the current system (opam-depext is still required to talk to the host package manager, although hooks are even possible to make that automatic)
  • Optimised use of the built-in solver, glpk is now also built in, hence not required to compile opam
  • Support for locked opam files and reproduceable build environments with the new pin-depends: field
  • A fix for a bug that appeared with OCaml 4.05.0, where installed executables where not found (requiring extra eval $(opam env))
  • Installed opam plugins can now be used even if the switch they were installed from is not currently selected

There is much more, please see the changelog for details.

NOTE: due to format changes, be careful when using the official 2.0 repository (at https://opam.ocaml.org/2.0): once it is switched to the new format, older betas will complain (depexts issues or post flags). Until then, this release will already work fine except for some possible quirks with depexts.

Other projects in OCaml