The Local Cache: conan list & cache path
Everything Conan downloads or builds lands in the local cache, ~/.conan2/p/. It's shared by all your projects: install fmt/12.1.0 once and every project on the machine reuses the same binary. This lesson shows how to look inside it, find files on disk, and keep it tidy.
conan list: what's in the cache
conan list takes a pattern that goes as deep as you ask: recipes, recipe revisions, package IDs, package revisions. Add -r <remote> to ask a server instead of the cache.
echo '--- conan list "*"'
conan list "*" 2>&1 | tail -n +2
echo '--- conan list "fmt/*#*" (recipe revisions)'
conan list "fmt/*#*" 2>&1 | tail -n +2
echo '--- conan list "spdlog/1.17.0:*" --format=compact (binaries)'
conan list "spdlog/1.17.0:*" --format=compact 2>&1 | tail -n +2--- conan list "*"
Local Cache
catch2
catch2/3.16.0
cmake
cmake/4.4.4
fmt
fmt/12.1.0
spdlog
spdlog/1.17.0
--- conan list "fmt/*#*" (recipe revisions)
Local Cache
fmt
fmt/12.1.0
revisions
6baf0fb8351783472b94ee6e36232391 (2026-08-03 10:55:53 UTC)
--- conan list "spdlog/1.17.0:*" --format=compact (binaries)
spdlog/1.17.0
spdlog/1.17.0#bcbaaf7147bda6ad24ffbd1ac3d7142c%1767636069.964 (2026-01-05 18:01:09 UTC)
spdlog/1.17.0#bcbaaf7147bda6ad24ffbd1ac3d7142c:68cf2b888a31d527b3476ac5bf6707b2db1ccd2d
settings: Linux, x86_64, Release, gcc, gnu17, libstdc++11, 13
options(diff):
requires: fmt/12.1.Z
| Pattern | Lists |
|---|---|
"*" or "fmt/*" |
recipes and versions |
"fmt/12.1.0#*" |
all recipe revisions (#latest for the newest) |
"fmt/12.1.0:*" |
binaries of the latest revision, with their settings and options |
"fmt/12.1.0#*:*#*" |
everything, down to package revisions |
"fmt/12.1.0:*" -p "build_type=Debug" |
binaries matching a package query |
--format=json is the scripting form; --format=html gives a browsable table.
conan cache path: where things live
The cache uses short hashed folder names (~/.conan2/p/fmta9b6…), so don't hard-code paths. Ask Conan:
conan cache path fmt/12.1.0 | sed "s#$HOME#~#"
conan cache path fmt/12.1.0:e02956bd268869d4519cb2b90dc7b4e51911a5d0 | sed "s#$HOME#~#"
cd "$(conan cache path fmt/12.1.0:e02956bd268869d4519cb2b90dc7b4e51911a5d0)"
find . -maxdepth 2 | sort | head -12~/.conan2/p/fmta9b6fc058bdc7/e
~/.conan2/p/b/fmte4752ff444c08/p
.
./conaninfo.txt
./conanmanifest.txt
./include
./include/fmt
./lib
./lib/libfmt.a
./licenses
./licenses/LICENSE
| Folder | Path command | Contents |
|---|---|---|
export (e) |
conan cache path <ref> |
the recipe conanfile.py and conandata.yml |
| exports_sources | --folder=export_source |
sources shipped with the recipe |
source (s) |
--folder=source |
the downloaded and patched source |
build (b) |
--folder=build |
the build tree of a package build |
package (p) |
conan cache path <ref>:<pkg_id> |
the final binary package: include/, lib/, bin/, licenses, conaninfo.txt |
Reading a recipe in the cache ($(conan cache path fmt/12.1.0)/conanfile.py) is the fastest way to find out a package's options and how it builds.
Cleaning up
Caches grow; CI machines especially. The tools:
conan remote disable conancenter > /dev/null
mkdir -p tmp && cd tmp
conan new header_lib -d name=scratch -d version=0.1 > /dev/null 2>&1
conan create . > /dev/null 2>&1
conan list "scratch/*" 2>&1 | tail -1
conan remove "scratch/*" -c 2>&1 | tail -2
conan list "scratch/*" 2>&1
echo "--- remove temporary folders, then check the rest"
conan cache clean "*" --source --build --download --temp
conan cache check-integrity "*" 2>&1 | tail -3 scratch/0.1
Local Cache
scratch/0.1#d9be52ffc2786d6f455157c616d658d3: Removed recipe and all binaries
Found 0 pkg/version recipes matching scratch/* in local cache
Local Cache
WARN: There are no matching recipe references
--- remove temporary folders, then check the rest
Found 4 pkg/version recipes matching * in local cache
fmt/12.1.0#6baf0fb8351783472b94ee6e36232391:e02956bd268869d4519cb2b90dc7b4e51911a5d0#a857dc2fda2e0c13d61393798f6a9684: Integrity check: ok
spdlog/1.17.0#bcbaaf7147bda6ad24ffbd1ac3d7142c: Integrity check: ok
spdlog/1.17.0#bcbaaf7147bda6ad24ffbd1ac3d7142c:68cf2b888a31d527b3476ac5bf6707b2db1ccd2d#81ce70d6997cc1fbe7ed27c13c7c4bac: Integrity check: ok
| Command | Effect |
|---|---|
conan remove "pkg/*" -c |
delete recipes and their binaries (-c = don't ask) |
conan remove "pkg/*:*" -c |
delete only the binaries, keep recipes |
conan remove "*" --lru=4w -c |
delete what hasn't been used for 4 weeks |
conan cache clean |
delete source, build, download and temp folders but keep packages |
conan cache check-integrity "*" |
verify manifests of everything in the cache |
conan cache save / conan cache restore |
export part of the cache to a .tgz and import it elsewhere |
conan cache save "fmt/12.1.0:*" --file=fmt.tgz plus conan cache restore fmt.tgz is a handy way to move packages to a machine without network access, or to pass binaries between CI jobs without a server.
Tip: never edit files inside the cache by hand. Packages have manifests, and
check-integritywould flag the change; more importantly, the nextconan installon another machine won't see your edit. Fix the recipe and runconan createinstead.
Test yourself
How do you list the binaries of fmt/12.1.0 in the local cache?
- conan list fmt
- conan list "fmt/12.1.0:*"
- conan search fmt -r local
- ls ~/.conan2/fmt
Why should you use conan cache path instead of building paths yourself?
- It's faster
- Cache folders have short hashed names that differ between machines
- Paths are secret
- It downloads the package
Which command frees disk space but keeps all installed packages usable?
- conan remove "*" -c
- conan cache clean
- rm -rf ~/.conan2
- conan lock create