This page describes how to install and configure opam. For further help on howto use opam, either readopam --help or move on to theUsage guide.
Generally, you should just reproduce the same installation steps as for theoriginal installation: upgrade from your system's package manager, or re-run thebinary installer. Opam will automatically update its internal repository at~/.opam on first run if needed (if using our installer script, a backup can bemade automatically).
To upgrade shell scripts, and enable sandboxing, don't forget to runopam init--reinit -ni.
Then see theUpgrade guide to check the changes.
The quickest way to get the latest opam up and working is to runthis script:
bash -c "sh <(curl -fsSL https://opam.ocaml.org/install.sh)"orthis script on Windows using PowerShell:
Invoke-Expression "& { $(Invoke-RestMethod https://opam.ocaml.org/install.ps1) }"This will simply check your architecture, download and install the properpre-compiled binary, backup your opam data if from an older version, and runopam init.
(If you have trouble withcurl, justdownload the scriptand runsh install.sh)
We provide pre-compiled binaries for:
If you don't like scripts, you can just pick your downloadhere, put it in your PATH asopam, and set it as executable, e.g.
sudo install <downloaded file> /usr/local/bin/opamNote that this script is intended for end-users, not CI. For that purpose,you can use pre-builtDocker images for variousconfigurations.
This is generally the recommended way,when available and up-to-date. Youcan check the following table, and the way to install opam thereafter:
pacman -S opamapt install opamdnf install opamurpmi opamapk add opampkg_add opampkg install ocaml-opamOpam packages forHomebrew andMacPorts are available.
# Homebrewbrew install opam# MacPortport install opamguix install opamwinget install Git.Git OCaml.opamWinGet the Windows Package Manager is available on Windows 11, modern versions of Windows 10, and Windows Server 2025.See theofficial documentation for additional info.
Sources of the latest stable version of opam are available on Github:
You can also download the full archives, including opam dependencies (thesedon't require any extra downloads):
Follow the instructions in the includedREADME.md to get opam built andinstalled from there.