uv cache dir
Show the cache directory.Usage
Description
Displays the absolute path to uv’s cache directory. By default, the cache is stored in:- Unix/macOS:
$XDG_CACHE_HOME/uvor$HOME/.cache/uv - Windows:
%LOCALAPPDATA%\uv\cache
--no-cache is used, the cache is stored in a temporary directory and discarded when the process exits.
An alternative cache directory may be specified via:
- The
cache-dirsetting in configuration files - The
--cache-diroption - The
UV_CACHE_DIRenvironment variable
Arguments
None.Options
None.Examples
Display cache directory
Use in scripts
Verify custom cache directory
Use cases
Locate cache for inspection
Find where uv stores cached packages:Backup cache directory
Create a backup of your cache:Monitor cache size
Check cache disk usage:Verify cache location
Confirm cache is on the same filesystem as your project:CI/CD cache configuration
Configure cache directory for CI systems:Troubleshooting
Diagnose cache-related issues:Cache directory structure
The cache directory contains:Configuration
Using environment variable
Using command-line option
Using configuration file
Inuv.toml or pyproject.toml:
Temporary cache
Performance considerations
Same filesystem requirement
For optimal performance, the cache should be on the same filesystem as your Python environments:- Same filesystem allows hardlinks (instant “copies”)
- Cross-filesystem requires actual file copies (slower)
- Clone mode (CoW) only works on same filesystem
Network filesystems
Avoid network filesystems for the cache:Platform-specific locations
Linux
macOS
Windows
Related commands
uv cache clean- Remove cache entriesuv cache prune- Remove unreachable cache entriesuv cache size- Show cache size
Notes
- The cache directory is created automatically when first needed
- Cache location can be customized via environment variable or configuration
- For best performance, keep the cache on the same filesystem as your projects
- The cache is global and shared across all projects
- Network filesystems can significantly slow down uv operations
- The cache directory structure is versioned (e.g.,
archive-v0) for future compatibility