Documentation Index
Fetch the complete documentation index at: https://mintlify.com/conda/conda/llms.txt
Use this file to discover all available pages before exploring further.
Overview
Theconda clean command removes unused packages and caches to free up disk space. It can clean cached package tarballs, index files, unused packages, temporary files, and log files.
Syntax
Removal Targets
Remove index cache, lock files, unused cache packages, tarballs, and logfiles.
Remove index cache.
Remove unused packages from writable package caches. WARNING: This does not check for packages installed using symlinks back to the package cache.
Remove cached package tarballs.
Remove all writable package caches. This option is not included with the
--all flag. WARNING: This will break environments with packages installed using symlinks back to the package cache.Remove temporary files that could not be deleted earlier due to being in-use. The argument is a path (or list of paths) to the environment(s) where the tempfiles should be found and removed.
Remove log files.
Output Options
Report all output as json. Suitable for using conda programmatically.
Can be used multiple times. Once for detailed output, twice for INFO logging, thrice for DEBUG logging, four times for TRACE logging.
Do not display progress bar.
Only display what would have been done.
Sets any confirmation values to ‘yes’ automatically. Users will not be asked to confirm any adding, deleting, backups, etc.
Examples
Common Use Cases
Cleaning Everything
Remove all cleanable items to maximize space savings:- Index cache
- Lock files
- Unused cache packages
- Tarballs
- Log files
Cleaning Package Tarballs
Remove downloaded package archives (safe operation):Cleaning Unused Packages
Remove packages not currently used by any environment:Cleaning Index Cache
Remove cached channel index data:Previewing Cleanup
See what would be removed without actually removing:Cleaning with Details
View exactly what is being removed:Cleaning Temporary Files
Remove leftover temporary files from a specific environment:Cleaning Log Files
Remove conda operation logs:Combining Cleanup Operations
Clean specific targets together:Automated Cleanup
Clean without confirmation prompts (useful in scripts):Understanding Package Caches
Conda maintains package caches to speed up environment creation and reduce downloads:- Tarballs: Compressed package archives as downloaded from channels
- Extracted packages: Unpacked packages ready for linking into environments
- Index cache: Cached channel metadata and package information
Safe vs. Risky Operations
Safe operations:--tarballs: Safe to remove; packages can be re-downloaded--index-cache: Safe to remove; will be rebuilt automatically--logfiles: Safe to remove; removes historical logs
--packages: Generally safe but doesn’t detect symlinked packages--force-pkgs-dirs: DANGEROUS; can break environments using symlinks
The
--packages option removes unused packages but does not check for packages installed using symlinks. Most conda installations use hard links or copies, making this safe. However, verify your installation method before using.The
--all flag does NOT include --force-pkgs-dirs for safety. You must explicitly use --force-pkgs-dirs if you want to remove all package caches.