opam

What opam is
opam is a free, source-based package manager for OCaml. It handles opam package definitions and archives, resolves dependencies, supports lockfiles, and allows offline installation. Multiple OCaml compiler versions can be installed at the same time. Separate switches provide independent prefixes, compilers, and installed packages for distinct projects or testing. Packages can be pinned to versions, local paths, archives, or Git, Mercurial, and Darcs repositories. The default community repository is opam.ocaml.org, with third-party repositories also supported. Commands cover searching, installing, removing, updating, and upgrading packages. Precompiled downloads are listed for Linux, macOS, FreeBSD, OpenBSD, NetBSD, and Windows, alongside system-package and source installation. Linux build, install, and removal instructions run in a sandbox described as isolated from the system. The homepage lists 4,679 packages. Bug reports and feature requests use the issue tracker, while broader questions can go to the OCaml-platform mailing list.
Who it suits
opam suits OCaml developers who need dependency management, isolated compiler environments, lockfiles, or offline installation across supported systems.
What it does well
- Free OCaml package manager
- Multiple compiler versions simultaneously
- Isolated switch environments
- Lockfiles and dependency resolution
- Offline installation support
What to know first
- Focused on OCaml packages
- Package operations depend on supported systems
- Source-based workflow may require setup
Getting started
- Visit opam.ocaml.org
- Install a precompiled binary, system package, or source build
- Choose the operating system package for Linux, macOS, FreeBSD, OpenBSD, NetBSD, or Windows
- Create a switch with its own compiler and package prefix
- Select the community repository or add a third-party repository
- Search for and install packages
Verdict
opam provides free package management with reproducible environments, flexible sources, and broad desktop and BSD support. Its switches and compiler handling are useful when projects need separate OCaml setups.
Questions
What does opam cost?
opam is free and provides a free plan.
Which systems are supported?
Supported systems include Linux, macOS, FreeBSD, OpenBSD, NetBSD, and Windows.
Can opam work offline?
Yes. opam supports offline installation.
How does opam isolate projects?
Switches provide separate installation prefixes with their own compiler and installed packages.
Which package sources can be pinned?
Sources can be pinned to a version, local path, archive, or Git, Mercurial, or Darcs repository.
Where can users get support?
Bug reports and feature requests go to the issue tracker, while general queries can use the OCaml-platform mailing list.
Facts from opam's own pages
- Commercial services
- OCamlPro provides commercial support, training, and consulting for opam. · opam.ocaml.org, 8 Oct 2026
- Compiler installations
- opam supports multiple simultaneous compiler installations. · opam.ocaml.org, 8 Oct 2026
- Compiler versions
- It supports multiple simultaneous OCaml compiler installations. · opam.ocaml.org, 8 Oct 2026
- Dependency resolution
- Yes · opam.ocaml.org, 22 Sept 2026
- Development workflow
- It supports a Git-friendly development workflow. · opam.ocaml.org, 8 Oct 2026
- External archive
- If a package source is not found, opam can try to retrieve it from Software Heritage archives. · opam.ocaml.org, 8 Oct 2026
- Free plan
- Yes · opam.ocaml.org, 22 Sept 2026
- Installation methods
- The install guide describes binary installation, system package managers, and building from source. · opam.ocaml.org, 8 Oct 2026
- Isolated environments
- A switch can have its own prefix, installed packages, and compiler version, allowing separate development environments. · opam.ocaml.org, 8 Oct 2026
- Linux downloads
- The install page lists precompiled binaries for Linux amd64, arm64, ppc64le, s390x, riscv64, armhf, and i686. · opam.ocaml.org, 8 Oct 2026
- Linux sandboxing
- On Linux, package build, install, and remove instructions run in a sandbox that the FAQ says is guaranteed not to affect the system. · opam.ocaml.org, 8 Oct 2026
- Lockfile support
- Yes · opam.ocaml.org, 22 Sept 2026
- macOS downloads
- The install page provides precompiled macOS amd64 and arm64 binaries and lists Homebrew and MacPorts packages. · opam.ocaml.org, 8 Oct 2026
- Offline installation
- Yes · opam.ocaml.org, 22 Sept 2026
- Package constraints
- It supports flexible package constraints. · opam.ocaml.org, 8 Oct 2026
- Package count
- The homepage lists 4,679 packages. · opam.ocaml.org, 8 Oct 2026
- Package formats
- opam package definition files and archives · opam.ocaml.org, 22 Sept 2026
- Package operations
- The usage guide describes commands to search, install, remove, update, and upgrade packages. · opam.ocaml.org, 8 Oct 2026
- Package repositories
- opam uses the community repository at opam.ocaml.org by default, and third-party repositories can be added or used instead. · opam.ocaml.org, 8 Oct 2026
- Package sources
- Packages can be pinned to a version, local path, archive, or Git, Mercurial, or Darcs repository. · opam.ocaml.org, 8 Oct 2026
- Project environments
- Switches provide separate installation prefixes, each with its own compiler and installed packages, for uses such as testing projects with different OCaml versions. · opam.ocaml.org, 8 Oct 2026
- Purpose
- opam is a source-based package manager for OCaml. · opam.ocaml.org, 8 Oct 2026
- Repositories
- opam uses the community software repository by default and can also use third-party repositories. · opam.ocaml.org, 8 Oct 2026
- Support
- Bug reports and feature requests go to opam's issue tracker; general queries can be addressed on the OCaml-platform mailing list. · opam.ocaml.org, 8 Oct 2026
Where opam stands on Freedom251
- Package Managers#46 of 93
- Package Registries#22 of 28