[ANN] opam 2.2.0 is out!

Hi everyone,

We’re very happy to finally announce the release of opam 2.2.0.

What’s new?

  • Windows support :window: :tada: (you can hear all about it in the blog post)
  • opam tree / opam why: new commands showing a tree view of the given packages and their dependencies and reverse-dependencies, respectively.
  • with-dev-setup: a new variable and argument to install the recommend developement setup for a local project.
  • opam pin --recursive and --subpath to have opam look at opam files elsewhere than the root directory of a project.
  • opam switch - to go back to the previous global switch (inspired by git switch -)
  • opam pin --current fixes a package to its current state (disabling pending reinstallations or removals from the repository)
  • opam pin remove --all removes all the pinned packages from a switch
  • opam exec --no-switch removes the opam environment when running a command. It is useful when you want to launch a command without opam environment changes.
  • opam clean --untracked removes untracked files interactively remaining from previous packages removal.
  • opam admin add-constraint <cst> --packages pkg1,pkg2,pkg3 applies the given constraint to a given set of packages
  • opam list --base has been renamed into --invariant, reflecting the fact that since opam 2.1 the “base” packages of a switch are instead expressed using a switch invariant
  • opam install --formula <formula> installs a formula instead of a list of packages. This can be useful if you would like to install one package or another one. For example opam install --formula '"extlib" | "extlib-compat"' will install either extlib or extlib-compat depending on what’s best for the current switch.
  • and many other features, performance improvements and fixes

:open_book: You can read our blog post for more information about these changes and a lot more.

How to upgrade

In case you plan a possible rollback, you may want to first backup your

~/.opam or $env:LOCALAPPDATA\opam directory.

The upgrade instructions are unchanged:

For Unix systems

bash -c "sh <(curl -fsSL https://raw.githubusercontent.com/ocaml/opam/master/shell/install.sh) --version 2.2.0"

or from PowerShell for Windows systems

Invoke-Expression "& { $(Invoke-RestMethod https://raw.githubusercontent.com/ocaml/opam/master/shell/install.ps1) }"

or download manually from the Github “Releases” page to your PATH.

You should then run:

opam init --reinit -ni

Happy hacking,
<> <> The opam team <> <> :camel: