skip to content

In Conan 2, in what order does conan install look in the local cache and the configured remotes for a recipe and its binaries?

level: middleimportance: should knowfreq 40%

answer

  1. cache before any remote
  2. remote list order matters
  3. first hit wins without --update
  4. -nr means cache only

basics

~20 s

Conan 2 looks in the local cache first and uses what it finds without contacting remotes. Otherwise it queries remotes in the order conan remote list shows and takes the first hit; --update checks all remotes for newer revisions.

solid answer

~50 s

For each reference, Conan 2 first checks the **local cache**. If the recipe is there, it is used as is and no remote is contacted, unless `--update` (`-u`) asks to look for newer revisions. Otherwise Conan walks the remotes in the order of `conan remote list` and downloads from the **first** remote that has the recipe. Binaries follow the same pattern: a cached binary with the right package ID wins, otherwise the remotes are queried in order and the first one holding that ID is used, again unless `--update` makes Conan compare all of them by timestamp. `-r <name>` restricts the search to named remotes, and `-nr` resolves only from the cache. A fresh Conan home defines one remote, `conancenter`. Teams usually put their own remote first with `conan remote add --index 0`, or disable ConanCenter so builds only see vetted packages.

code

console · 12 lines
console
$ conan remote list
conancenter: https://center2.conan.io [Verify SSL: True, Enabled: True]
$ conan remote add team https://conan.example.internal/team --index 0
$ conan remote disable conancenter
$ conan list "fmt/*:*"
Local Cache
  fmt
    fmt/11.0.2
      revisions
        f84efa4efaf28c33b584cb1b416f5ced (2026-10-26 17:19:09 UTC)
          packages
            b8da06845b8444be84fc8e71e7354dc6f23831c8

go deeper

for a junior

Know that the cache comes first and that remotes are queried in the order conan remote list shows.

for a middle

Explain first-hit-wins without --update, and the -r and -nr flags, for both recipes and binaries.

for a senior

Diagnose laptop-versus-CI differences caused by cached revisions, and keep remote order and allowed packages under control.

for a principal

Decide whether builds may reach ConanCenter directly or only a vetted internal mirror, and how remotes are distributed to every machine.

## The local cache Every Conan 2 installation has a **local cache** inside the Conan home (`~/.conan2` by default, or `CONAN_HOME`). It stores exported recipes, their sources, build folders and binary packages, each under a short hashed folder inside `p/`. Nothing in it should be edited by hand; the commands are the interface: - `conan list "fmt/*:*"` shows recipes, revisions and package IDs with their settings and options; - `conan cache path fmt/11.0.2` prints where a recipe lives; - `conan remove "fmt/*" -c` deletes matching recipes and packages without asking; - `conan cache clean` removes temporary source, build and download folders; - `conan cache save` and `conan cache restore` move a set of packages between machines as an archive, for example into an air-gapped network. ## Remotes A **remote** is a server that stores recipes and binaries. A fresh Conan 2.33 home lists exactly one, `conancenter` at `https://center2.conan.io`. Remote commands: | Command | Effect | |---|---| | `conan remote list` | shows the remotes in priority order | | `conan remote add <name> <url>` | appends a remote; `--index 0` puts it first | | `conan remote disable <pattern>` | keeps the entry but stops using it | | `conan remote login <name> <user>` | authenticates for uploads or private reads | | `conan upload "pkg/*" -r <name>` | publishes recipes and binaries | `conan remote add` also accepts `--allowed-packages` to restrict which references a remote may serve and `--recipes-only` to forbid binary downloads from it. ## The lookup order for a recipe 1. **Cache.** If any revision of the requested recipe is cached, Conan uses the latest cached revision and contacts no remote. 2. **Remotes in order.** If the recipe is not cached, Conan asks each enabled remote in list order and downloads from the first that has it. 3. **With `--update`.** Conan checks the remotes even when the recipe is cached, compares revisions by timestamp, and installs a newer one if found. Version ranges are resolved in the same spirit, cache first and then remotes, but that belongs to the material on versions and lockfiles. ## The lookup order for a binary Once the package ID is known: 1. a binary with that ID in the cache is used; 2. otherwise the remotes are queried in order, and the first one holding that package ID provides it, unless `--update` makes Conan collect all of them and take the newest; 3. if no remote has it, the compatibility rules try alternative configurations, again cache first and then servers; 4. if that fails too, the `--build` policy decides between building and stopping. `-r <name>` limits steps 2 and 3 to the named remotes, and `-nr`/`--no-remote` skips them entirely. ## Debugging a surprising source When a binary arrives from an unexpected place, the install output says where each one came from: `Cache`, `Download` with the remote's name, or `Build`. Three quick checks narrow it down: 1. `conan remote list` to see the current order and which remotes are enabled; 2. `conan list "pkg/1.0:*" -r <remote>` against each remote to see which ones hold the package ID; 3. a rerun with `-r <remote>` to force a single source and compare. ## Consequences in practice - **Stale but fast.** A developer whose cache already holds a recipe revision keeps using it until they pass `--update` or remove it. CI machines with fresh caches may resolve something newer, which is one reason lockfiles exist. - **Remote order is policy.** If ConanCenter comes first, a package that also exists in the team's remote is taken from ConanCenter. Putting the team remote at index 0, or disabling `conancenter` and mirroring only vetted packages, makes the source of every binary explicit. - **Ephemeral CI caches** download everything on every run; a shared cache or a nearby remote mirror saves the time without changing correctness. - **Distributing the configuration.** `conan config install` copies remotes, profiles and conf from a git repository or folder into every Conan home, so all machines see the same remotes in the same order.

  • A developer's build uses an older recipe revision than CI. What is the likely cause?
    The developer's cache already held a revision, and Conan 2 uses cached recipes without contacting remotes unless `--update` is given. CI starts from an empty cache and downloads the latest revision. Running with `--update`, or pinning with a lockfile, aligns them.
  • How can a remote be prevented from serving binaries while still providing recipes?
    Add it with `conan remote add ... --recipes-only`. Conan then downloads recipes from it but never binaries, so every binary comes from another remote or a local build.

  • Conan always checks every remote for newer recipes before using the cache.
  • Remote order does not matter, since Conan picks the best match across all.
  • -nr makes Conan skip the local cache and use only remotes.
  • Editing files under the cache's p/ folder is a fine way to patch a package.
  • A fresh Conan 2 home has no remotes defined.