OCaml opam

ID

opam

Links

Home page · Documentation · Repository

Upstream stars

⭐ 1,382

Last commit

2026-09-22

Version requirement

>= 2

Platforms

🅱️ BSD · 🐧 Linux · 🍎 macOS

Operations

installed · search · install · upgrade · upgrade_all · remove · sync

purl types

pkg:opam/

CLI name

opam

Every call

opam --color=never --yes <command>

Issues and PRs

📦 manager: opam

Source

opam.toml

opam is the OCaml package manager (https://opam.ocaml.org).

Every listing goes through --short --columns=name,version, which opam documents as dropping the header and joining columns with a space, giving one name version pair per line with no alignment to strip.

No outdated: opam list --upgradable reports what would move, but naming both the installed and the candidate version in one listing needs a column set this definition cannot verify against an upstream sample, so the operation is left undeclared and upgrade --all still works.

Every operation targets opam’s currently active switch, which is whatever OPAMSWITCH or the current directory resolves to, exactly as a bare opam call in the same shell would. Per-switch targeting is not supported yet.

What mpm adds to opam

Through mpm, opam gains --exact and --extended search, to narrow to exact names or match descriptions.

Bigger still, mpm reaches across every manager at once: mpm installed and mpm outdated cover opam alongside every other manager you run in one table, mpm upgrade --all updates them together, and mpm sbom exports the whole machine as one bill of materials.

Every mpm command also gains --dry-run and --plan previews, cross-scheme version comparison and purl identifiers. See manager augmentations for how each one is built.

Your opam commands, in mpm

You already know opam: each operation maps one-to-one onto mpm, in an interface shared by every manager.

To…

With opam

With mpm

List what’s installed

opam list --installed --short --columns=name,version

mpm --opam installed

Search for a package

opam list --search <query> --short --columns=name,version

mpm --opam search <query>

Install a package

opam install <package_id>

mpm install pkg:opam/<package_id>

Upgrade one package

opam upgrade <package_id>

mpm --opam upgrade <package_id>

Upgrade everything

opam upgrade

mpm --opam upgrade --all

Remove a package

opam remove <package_id>

mpm remove pkg:opam/<package_id>

Prefix any command above with --dry-run to simulate the underlying manager calls without touching the system: the safe way to watch what mpm would do before trusting it.

Operations

Operation

Supported

Notes

installed

✅

outdated

orphans

search

✅

Exact and extended search backfilled by mpm.

install

✅

upgrade

✅

upgrade_all

✅

remove

✅

sync

✅

cleanup

doctor

Configuration

  • Ignore opam on the mpm CLI by passing the --no-opam option.

  • Ignore it for every run in your configuration:

    [mpm]
    opam = false
    
  • Raise the timeout of all opam calls:

    [mpm.overrides.opam]
    timeout = 900
    
  • Run mpm config-template opam to print all overridable settings for your configuration file:

    [mpm.overrides.opam]
    cli_names = [
        "opam",
    ]
    cli_search_path = []
    dry_run = false
    ignore_auto_updates = true
    plan = false
    post_args = []
    pre_args = [
        "--color=never",
        "--yes",
    ]
    pre_cmds = []
    requirement = ">=2.0.0"
    stop_on_error = false
    unmaintained = false
    version_cli_options = [
        "--version",
    ]
    version_regexes = [
        "(?P<version>\\d+(?:\\.\\d+)+\\S*)",
    ]
    

The arguments and environment variables listed in the box atop this page are forced on every opam call, so runs stay quiet, non-interactive and reproducible: the defaults you would set in CI anyway.

Recipes

A few jobs you would otherwise script around opam, one mpm command each:

  • Snapshot and clone a machine: mpm --opam dump opam.toml, then mpm restore opam.toml on the next one.

  • Export a compliance SBOM: mpm --opam sbom (CycloneDX by default, --spdx for SPDX).

Privilege escalation

mpm runs this manager as the current user and never prepends sudo by default. Flip the policy for its privileged operations with --sudo or the per-manager sudo override.

None of its operations is privileged.

See privilege escalation for the full policy.

Cooldown

State of OCaml opam’s release-age gating, from the cooldown support table:

Status: ❌ None

A cooldown only pays off where a compromised release can be withdrawn while the clock runs, and can only be emulated where the registry dates its releases. From the retraction table:

  • Registry: Git-manifest indexes

  • Retraction: Index revert: reverting the manifest, Portfile or derivation commit withdraws the version

  • Publish date: ❌ only the commit date, which is client-set and trivially backdated. A date declared in the manifest, like winget’s optional ReleaseDate, is author-supplied too and no sounder

With --cooldown set, mpm skips this manager’s install and upgrade operations rather than run them unguarded (fail-closed); --cooldown best-effort opts back in.

Reference traces

A collection of raw native outputs captured from the manager’s own CLI and recorded in the bundled definition. If you know OCaml opam well and a transcript below looks wrong, or a newer release changed its output format, report it.

$ opam list --installed --short --columns=name,version
base-bigarray base
base-threads base
dune 3.11.1
ocaml 4.14.1
ocamlfind 1.9.6
$ opam list --search {query} --short --columns=name,version
lwt 5.7.0
lwt_ppx 2.1.0
lwt_ssl 1.2.0

Version check

The version is probed by running:

$ opam --version
2.1.5

and extracted with:

r"(?P<version>\d+(?:\.\d+)+\S*)"

Upstream project

Metrics

ocaml/opam

Activity

commit activity commits since open issues open pull requests

Popularity

forks watchers contributors

Metadata

latest release release date license main language

Changelog

  • 8.0.0 (2026-09-20)

    • Add the OCaml opam package manager with installed, search, install, upgrade, remove and sync support.