opam installs and upgrades OCaml packages and compilers from source. It supports multiple compilers, flexible version constraints, and workflows that work well with Git.
Overview
opam is the package manager for the OCaml language. It resolves and builds packages from source, tracks installed versions, and can maintain several compiler installations on one machine with independent switch environments.
Day-to-day use follows familiar commands to list available packages, install libraries such as LWT, refresh the package index, and upgrade installed packages. The tool integrates with the official community package repository for OCaml libraries and compilers, and unofficial repositories can be added when needed.
Constraint solving uses external dependency libraries documented in the project, and the CLI exposes configuration, reporting, and per-command help for troubleshooting. A separate opam-lib allows other tools to embed the same package logic when linked against the published libraries.
Installation paths include binary installers on the project website, building from source with GNU make and a supported OCaml toolchain, and platform-specific notes for environments such as Cygwin on native Windows. Documentation includes a user manual, guides, packaging notes, and manual pages.
Key features
- Source-based OCaml package installs
- Multiple simultaneous compiler switches
- Flexible version constraints
- Git-friendly development workflow
- Package list, install, update, upgrade
- Official community package repository
- CLI config and diagnostic reporting
- Embeddable opam-lib for tools
Use cases
- Managing OCaml library dependencies
- Testing projects on several compiler versions
- Installing OCaml compilers and tools
- Publishing and consuming opam packages