LinuxCommandLibrary

uv-cache

Manage uv's dependency cache

TLDR

Show the cache directory path

$ uv cache dir
copy

Clean the entire cache (removes all cached packages and environments)
$ uv cache clean
copy

Clean the cache for specific packages
$ uv cache clean [package1 package2 ...]
copy

Prune all unreachable objects from the cache
$ uv cache prune
copy

Prune cache optimized for CI environments like GitHub Actions
$ uv cache prune --ci
copy

Use a specific cache directory
$ uv cache clean --cache-dir [path/to/cache]
copy

Clean cache with verbose output
$ uv cache clean [[-v|--verbose]]
copy

SYNOPSIS

uv cache COMMAND
uv cache clean
uv cache dir

PARAMETERS

clean
    Clears all contents of the uv package installer's cache. This action removes all stored packages, build artifacts, and metadata, which can free up disk space and resolve issues caused by corrupted cache entries.

dir
    Displays the absolute path to the directory where uv stores its cache. This helps users locate the cache for manual inspection or management outside of the uv command.

DESCRIPTION

The uv-cache command is a subcommand of the uv Python package installer, designed specifically for managing its internal cache. uv is a modern, fast, and secure tool for Python dependency resolution and package installation, often positioned as an alternative to pip. The cache stores downloaded packages, build artifacts, and resolved dependency information, significantly speeding up subsequent operations. This command provides functionalities to inspect the cache's location and to clear its contents. Clearing the cache can be useful for freeing up disk space, especially in environments with limited storage, or for troubleshooting issues related to corrupted or stale cache entries, ensuring uv operates with the most up-to-date components.

CAVEATS

This command is part of the uv Python package installer and is not a standard system-wide Linux utility; it must be installed separately, typically via pipx or pip. Clearing the cache can free up disk space, but it will cause uv to re-download and re-build packages and dependencies, potentially increasing the time for subsequent installation or resolution operations until the cache is repopulated.

CACHE LOCATION

The cache for uv is typically located in a directory specific to your operating system's user cache standards. For Linux, this is commonly found under $HOME/.cache/uv. The uv cache dir command can be used to precisely determine this location on your system, which might vary based on environment variables or specific configurations.

HISTORY

The uv project, including its cache management capabilities, was developed by Astral and gained significant traction in early 2024 as a high-performance alternative to traditional Python package management tools like pip. The uv-cache subcommand was designed from the outset as an essential component for users to manage the persistent cache that underpins uv's speed and efficiency, allowing for quick re-installations and resolutions by reusing downloaded and built artifacts.

SEE ALSO

uv(1), pip(1), pipx(1)

Copied to clipboard