cpm registry

Install CPM

One command installs CPM and, if your machine doesn't have them yet, a C++ compiler and Ninja.

curl -fsSL https://cpm-registry.com/install.sh | sh

In a terminal. Installs a C++ compiler and Ninja too, if you need them.

You can read the script before you run it.

What the installer does

  1. 1Asks this registry for the latest CPM release.
  2. 2Downloads it from GitHub, and checks its SHA-256 before installing anything.
  3. 3Puts cpm in ~/.cpm/bin and adds that folder to your PATH: your user PATH on Windows, or a line in ~/.profile and your shell's startup files elsewhere.
  4. 4Runs cpm setup, which shows what it finds, lists every change and download (with its size), and asks before making them.

The compiler and Ninja downloads are pinned, with checksums, in toolchains.json. Run the command again to update CPM.

Options

Set these environment variables for the installer:

CPM_HOME
Install somewhere other than ~/.cpm. The installer remembers the choice.
CPM_NO_SETUP=1
Skip cpm setup. Run it yourself later.
CPM_NO_MODIFY_PATH=1
Leave your PATH, CPM_HOME and shell profiles alone.
curl -fsSL https://cpm-registry.com/install.sh | CPM_HOME=/opt/cpm sh
$env:CPM_HOME = 'C:\cpm'; irm https://cpm-registry.com/install.ps1 | iex

Download by hand

 

PlatformFileSHA-256

Put the binary on your PATH, then run cpm setup.

Troubleshooting

cpm is not found

Open a new terminal. On Linux and macOS, . ~/.cpm/env also updates the one you are in.

What does CPM find on this machine?

cpm setup --check reports the compiler, Ninja and other tools without changing anything.

I already have a compiler

CPM uses GCC 13 or later, Clang 17 or later, and Ninja 1.10 or later from your PATH, and cpm setup installs nothing. To pick a compiler, set CXX=clang++, or "cxx" in ~/.cpm/config.jsonc.

Windows: keep CPM_HOME short

GCC's headers sit about 150 characters deep, and Windows limits paths to 260 characters. cpm setup refuses a CPM_HOME longer than about 80 characters; use something like C:\cpm.

Uninstall

Delete ~/.cpm (%USERPROFILE%\.cpm on Windows). Then remove the .cpm/env line from your shell profiles, or on Windows the .cpm\bin entry from your user PATH. Packages your distribution installed stay.

More in the command reference.