Skip to main content

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/uv or $HOME/.cache/uv
  • Windows: %LOCALAPPDATA%\uv\cache
When --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-dir setting in configuration files
  • The --cache-dir option
  • The UV_CACHE_DIR environment variable
Note that it is important for performance for the cache directory to be located on the same file system as the Python environment uv is operating on.

Arguments

None.

Options

None.

Examples

Display cache directory

Expected output (Unix/macOS):
Expected output (Windows):

Use in scripts

Verify custom cache directory

Expected output:

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

In uv.toml or pyproject.toml:
Then:

Temporary cache

This shows a temporary directory that will be discarded when uv exits.

Performance considerations

Same filesystem requirement

For optimal performance, the cache should be on the same filesystem as your Python environments:
Why this matters:
  • 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

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