conda-clean
Clean unused conda packages and caches
TLDR
Delete all temporary or unused files verbosely and say yes to all confirmations
Delete only index cache, tarballs, and log files
Delete only temporary [c]ache files that could not be deleted earlier due to being in use
Delete only unused packages. Might delete packages installed with softlinks
Force delete all writable packages. More broad than the --all option. Will delete packages installed with softlinks
Display help
SYNOPSIS
conda clean [OPTIONS]
PARAMETERS
--all, -a
Remove index cache, lock files, unused cache packages, and tarballs (equivalent to -p -t -s -i)
--packages, -p
Remove unused packages from writable cache directories
--source-cache, -s
Remove extraction caches for unlinked packages
--tarballs, -t
Remove cached tar files
--index-cache, -i
Remove cached index files from all index caches
--json
Return JSON report listing what would be removed
--dry-run
Report actions without changes
--force-pkgs-dirs
Use hard links for inter-pkgs-dir linking (symlinks otherwise)
--force-preferred
Use hard links for packages in preferred index
--log-level <LEVEL>
Set logging verbosity (debug, info, warnings, error, critical; default: info)
-h, --help
Show help message and exit
-V, --version
Show conda-clean version and exit
DESCRIPTION
The conda clean command frees disk space by removing unused packages, tarballs, index caches, source caches, and lock files accumulated by Conda.
Conda, a cross-platform package and environment manager popular for Python and scientific computing, downloads packages into cache directories (<pkgs_dir>/cache). These caches persist even after installation or environment removal, leading to substantial disk usage growth over time—often gigabytes.
conda clean provides targeted cleanup options: remove only unused packages (--packages), tarballs (--tarballs), extraction caches (--source-cache), or index files (--index-cache). Use --all for comprehensive cleanup. Dry-run (--dry-run) and JSON (--json) modes allow previewing actions without changes, aiding safe usage.
It's essential for users with limited storage, multiple environments, or heavy package activity. Post-cleanup, Conda redownloads only as needed, preserving functionality while optimizing space. Always run in base environment unless specified.
CAVEATS
Cleanup is irreversible; Conda redownloads removed files on demand. Use --dry-run first. Run in base environment to affect all pkgs_dirs. May require admin privileges for some caches.
EXAMPLES
conda clean --all (full cleanup)
conda clean -p (packages only)
conda clean --dry-run --json (preview report)
CACHE LOCATIONS
Typically ~/.conda/pkgs or $CONDA_PKGS_DIR. Check with conda info.
HISTORY
Introduced in Conda 4.4 (2017) to address cache bloat complaints. Enhanced in later versions (e.g., 4.7+) with --json, --source-cache, and hard-link options for efficiency.
SEE ALSO
conda(1)


