uv-cache
Manage uv's dependency cache
TLDR
Show the cache directory path
Clean the entire cache (removes all cached packages and environments)
Clean the cache for specific packages
Prune all unreachable objects from the cache
Prune cache optimized for CI environments like GitHub Actions
Use a specific cache directory
Clean cache with verbose output
SYNOPSIS
uv cache [--cache-dir <DIR>] [--scope <SCOPE>] <SUBCOMMAND>
PARAMETERS
clean [<SOURCES>...]
Remove unused packages from the cache. Accepts optional package specs to target specific items.
dir
Print the path to the cache directory.
forget <PACKAGE>
Forget metadata for installed packages, forcing re-resolution.
prune
Prune cache entries not used recently (safer than clean).
stats
Display cache usage statistics like size and entry count.
verify-checksums
Verify checksums of cached files for integrity.
--cache-dir <DIR>
Path to custom cache directory (default: ~/.cache/uv on Unix).
--scope <SCOPE>
Limit to scope: global, host, sys, venv:<path>, or app:<path>.
DESCRIPTION
The uv cache command manages the local cache used by uv, a fast Python package installer and resolver. UV stores downloaded wheels, source distributions, and other artifacts in a cache to speed up subsequent installations and resolutions. This command provides subcommands to inspect, clean, and optimize the cache.
Use it to reclaim disk space by removing unused items, verify integrity, or view statistics. The cache is organized by scopes like global, host, sys, or project-specific venvs/apps, allowing targeted management. For example, uv cache clean removes unused packages, while uv cache prune is more conservative, keeping recently used items.
This is essential for large projects or CI environments where cache bloat can occur. UV's cache is more efficient than pip's, with built-in deduplication and compression, but manual intervention ensures optimal performance.
CAVEATS
Cleaning the cache may require re-downloading packages on next use; use prune for less aggressive removal. Cache is shared across Python versions and projects by default.
EXAMPLES
uv cache clean
uv cache prune
uv cache stats
uv cache dir --scope venv:.
CACHE LOCATIONS
Unix: $XDG_CACHE_HOME/uv or ~/.cache/uv.
Windows: %LOCALAPPDATA%\uv\cache.
HISTORY
Part of uv, developed by Astral.sh and released in early 2024 (v0.1+). Cache management evolved with v0.2.x to include prune and stats for better usability.


