ocamlopam

opam switch list-available says no matches found


I tried following the installation process for opam. After that, I tried to use opam to install a package:

> opam install lwt
[ERROR] No switch is currently set. Please use 'opam switch' to set or install a switch

Then I try:

> opam switch list-available
# Listing available compilers from repositories: default
# No matches found

Last, I try this:

> opam switch create default
[ERROR] No compiler matching `default' found, use `opam switch list-available' to see what
        is available, or use `--packages' to select packages explicitly.

I have OCaml 4.12.0 installed and opam version 2.1.0. What should I do to fix this?


Solution

  • If there are no switch available, you should try to update the opam repository first

    opam update
    

    It is likely that you are on a recently supported architecture (aka the Arm64/MacOS) and that there are no available switch for your architecture with your current package database. If this doesn't work, you should check which repository you are using with opam -repo.