ClearDisk -- Free macOS Developer Cache Cleaner

Conda & Anaconda Cache Cleanup on Mac — Reclaim 10-40GB+

Updated March 2025 -- Covers Anaconda, Miniconda, Miniforge, Mamba, and conda-forge -- 10 min read

If you use conda for data science, machine learning, or scientific computing on macOS, you may not realize how much disk space your conda installation is consuming. Between downloaded package tarballs, extracted packages in pkgs/, multiple environments, and the base installation itself, it's common to find 10-40GB+ of conda-related files on a developer Mac.

This guide covers every conda-related disk consumer on macOS, with exact commands to audit and clean each one safely.

Table of Contents 1. Quick Audit — Where Is Your Conda Disk Space Going? 2. Package Cache (pkgs/) — The #1 Space Consumer 3. Conda Environments — The Hidden Giants 4. conda clean — The Built-In Cleanup Tool 5. Anaconda vs. Miniconda — Why It Matters for Disk Space 6. Index Cache and Metadata 7. Mamba / Micromamba Caches 8. Jupyter and Notebook Storage 9. Completely Removing Conda from macOS 10. Automate Conda Cleanup 11. Quick Reference Cheatsheet 12. FAQ

1. Quick Audit — Where Is Your Conda Disk Space Going?

Before cleaning anything, let's see exactly what's consuming disk space. Run this audit script:

# Full conda disk audit
echo "=== Conda base installation ==="
du -sh ~/miniconda3/ 2>/dev/null
du -sh ~/anaconda3/ 2>/dev/null
du -sh ~/miniforge3/ 2>/dev/null
du -sh ~/mambaforge/ 2>/dev/null
du -sh /opt/homebrew/Caskroom/miniconda/ 2>/dev/null

echo ""
echo "=== Package cache (pkgs/) ==="
du -sh ~/miniconda3/pkgs/ 2>/dev/null
du -sh ~/anaconda3/pkgs/ 2>/dev/null
du -sh ~/miniforge3/pkgs/ 2>/dev/null

echo ""
echo "=== Environments ==="
du -sh ~/miniconda3/envs/*/ 2>/dev/null | sort -hr
du -sh ~/anaconda3/envs/*/ 2>/dev/null | sort -hr

echo ""
echo "=== Conda metadata ==="
du -sh ~/.conda/ 2>/dev/null
du -sh ~/.condarc 2>/dev/null

echo ""
echo "=== Total conda disk usage ==="
du -sh ~/miniconda3/ ~/anaconda3/ ~/miniforge3/ ~/mambaforge/ 2>/dev/null

Typical results on a data science Mac:

LocationTypical SizeWhat It Contains
~/anaconda3/5-25GBFull Anaconda distribution + packages
~/miniconda3/1-15GBMinimal installer + installed packages
pkgs/2-10GBDownloaded package tarballs and extracted packages
envs/1-20GBAll created environments
~/.conda/50-500MBIndex cache, environment registry

2. Package Cache (pkgs/) — The #1 Space Consumer

The pkgs/ directory is conda's package cache. Every package you've ever installed is cached here — both the compressed tarball and the extracted version. This directory only grows; conda never automatically cleans it.

# See exactly what's in the package cache
du -sh ~/miniconda3/pkgs/ 2>/dev/null
ls ~/miniconda3/pkgs/ | wc -l

# Top 20 largest cached packages
du -sh ~/miniconda3/pkgs/*/ 2>/dev/null | sort -hr | head -20

# Count compressed tarballs vs extracted dirs
ls ~/miniconda3/pkgs/*.tar.bz2 2>/dev/null | wc -l
ls ~/miniconda3/pkgs/*.conda 2>/dev/null | wc -l

Why is it so large? Every time conda installs or updates a package, both the download archive and extracted files are kept. If you've been using conda for a year or more, you likely have hundreds of cached packages — many for versions you no longer use.

Clean the Package Cache

# Remove only tarballs (safest — packages stay extracted)
conda clean --tarballs -y

# Remove unused extracted packages
conda clean --packages -y

# Remove both tarballs AND unused packages
conda clean --all -y

# Dry run — see what would be removed without deleting
conda clean --all --dry-run
Tip: Running conda clean --all -y is safe. It only removes cached downloads and packages not currently linked to any environment. Active environments are never touched.

3. Conda Environments — The Hidden Giants

Each conda environment is a complete, isolated copy of Python and its packages. A single data science environment with PyTorch, TensorFlow, or JAX can easily be 3-8GB. Multiple environments multiply this quickly.

# List all environments with their locations
conda env list

# Size of each environment
du -sh ~/miniconda3/envs/*/ 2>/dev/null | sort -hr
du -sh ~/anaconda3/envs/*/ 2>/dev/null | sort -hr

# Check what packages are in an environment
conda list -n my_env

# Count packages per environment
for env in $(conda env list | grep -v "^#" | awk '{print $1}' | grep -v "^$"); do
    count=$(conda list -n "$env" 2>/dev/null | grep -v "^#" | wc -l)
    echo "$env: $count packages"
done

Remove Unused Environments

# Remove a specific environment
conda env remove -n old_project

# Remove by path (for envs created with --prefix)
conda env remove -p /path/to/env

# Force remove even if active
conda deactivate
conda env remove -n unwanted_env
Warning: Before removing an environment, export it if you might need it later:
conda env export -n my_env > my_env_backup.yml
You can recreate it later with conda env create -f my_env_backup.yml

Find Stale Environments

Look for environments you haven't used recently:

# Find envs not accessed in 60+ days (by python binary access time)
for env_dir in ~/miniconda3/envs/*/; do
    env_name=$(basename "$env_dir")
    last_access=$(stat -f "%Sa" -t "%Y-%m-%d" "$env_dir/bin/python" 2>/dev/null || echo "unknown")
    size=$(du -sh "$env_dir" 2>/dev/null | awk '{print $1}')
    echo "$size  $env_name  (last accessed: $last_access)"
done | sort -hr

4. conda clean — The Built-In Cleanup Tool

Conda has a built-in conda clean command with several useful flags:

CommandWhat It CleansTypical Savings
conda clean -tCompressed tarballs (.tar.bz2, .conda)1-5GB
conda clean -pUnused extracted packages1-5GB
conda clean -iIndex cache (channel metadata)50-200MB
conda clean -lLock filesMinimal
conda clean -fTemp files and logfilesVaries
conda clean --allAll of the above2-10GB
# The most common cleanup command
conda clean --all -y

# Preview what would be cleaned
conda clean --all --dry-run

# Clean only index cache (useful when having solver issues)
conda clean -i -y

5. Anaconda vs. Miniconda — Why It Matters for Disk Space

The choice between Anaconda and Miniconda has a huge impact on disk usage:

DistributionBase Install SizeIncluded Packages
Anaconda4-6GB250+ packages (NumPy, Pandas, SciPy, Jupyter, etc.)
Miniconda200-400MBMinimal (conda + Python only)
Miniforge200-400MBMinimal (conda-forge defaults)
Micromamba~10MBStandalone binary (no Python)
Tip: If you're using Anaconda and only need a few packages, consider switching to Miniconda. You'll save 4-5GB immediately on the base install, and you can install exactly what you need per environment.

Migrate from Anaconda to Miniconda

# 1. Export your environments first
conda env list
conda env export -n my_project > my_project.yml
conda env export -n ml_env > ml_env.yml

# 2. Remove Anaconda
conda install anaconda-clean -y
anaconda-clean --yes
rm -rf ~/anaconda3/

# 3. Install Miniconda
# Download from https://docs.conda.io/en/latest/miniconda.html
bash Miniconda3-latest-MacOSX-arm64.sh

# 4. Recreate only the environments you need
conda env create -f my_project.yml

6. Index Cache and Metadata

Conda caches channel index data to speed up environment solving. Over time, this metadata accumulates:

# Check index cache size
du -sh ~/.conda/ 2>/dev/null
du -sh ~/miniconda3/pkgs/cache/ 2>/dev/null

# List conda config (channels add to cache size)
conda config --show channels

# Clean index cache
conda clean -i -y

# Remove channel metadata
rm -rf ~/.conda/pkgs_dirs/ 2>/dev/null

If you have many custom channels configured (conda-forge, bioconda, pytorch, nvidia), the index cache can grow to several hundred MB. Cleaning it forces a fresh download on next install, which also fixes solver issues caused by stale metadata.

7. Mamba / Micromamba Caches

If you use Mamba (the faster conda alternative) or Micromamba, they have their own cache locations:

# Mamba uses the same pkgs/ directory as conda
# So conda clean works for mamba too
mamba clean --all -y

# Micromamba has its own root
du -sh ~/micromamba/ 2>/dev/null
du -sh ~/.local/share/mamba/ 2>/dev/null
micromamba clean --all -y

# Check Mambaforge installation
du -sh ~/mambaforge/ 2>/dev/null
du -sh ~/mambaforge/pkgs/ 2>/dev/null
Tip: If you've switched from conda to mamba but still have the old conda installation, you may be paying for both. Check which conda and which mamba to see what's active.

8. Jupyter and Notebook Storage

Conda is often paired with Jupyter, which has its own disk footprint:

# Jupyter data directory
du -sh ~/Library/Jupyter/ 2>/dev/null

# Jupyter kernels (one per environment)
jupyter kernelspec list 2>/dev/null
du -sh ~/Library/Jupyter/kernels/*/ 2>/dev/null

# IPython history and cache
du -sh ~/.ipython/ 2>/dev/null

# Jupyter runtime files
du -sh ~/Library/Jupyter/runtime/ 2>/dev/null

# Notebook checkpoints scattered across projects
find ~ -maxdepth 5 -type d -name ".ipynb_checkpoints" 2>/dev/null | head -20

Clean Jupyter Artifacts

# Remove orphaned kernels (from deleted environments)
jupyter kernelspec list
jupyter kernelspec uninstall old_kernel_name

# Clean notebook checkpoints
find ~/projects -type d -name ".ipynb_checkpoints" -exec rm -rf {} + 2>/dev/null

# Clear IPython history
rm -rf ~/.ipython/profile_default/history.sqlite 2>/dev/null

9. Completely Removing Conda from macOS

If you want to completely remove conda and start fresh (or switch to a different setup):

# 1. Export environments you want to keep
for env in $(conda env list | grep -v "^#" | awk '{print $1}' | grep -v "^$" | grep -v "base"); do
    conda env export -n "$env" > "${env}_backup.yml" 2>/dev/null
    echo "Exported: $env"
done

# 2. Optional: Install anaconda-clean for thorough removal
conda install anaconda-clean -y
anaconda-clean --yes

# 3. Remove the installation directory
rm -rf ~/miniconda3/     # or ~/anaconda3/ or ~/miniforge3/
rm -rf ~/mambaforge/

# 4. Remove conda configuration
rm -rf ~/.conda/
rm -f ~/.condarc

# 5. Remove shell initialization from ~/.zshrc
# Edit ~/.zshrc and remove the conda initialize block:
# >>> conda initialize >>>
# ... (several lines)
# <<< conda initialize <<<

# 6. Remove Jupyter artifacts
rm -rf ~/Library/Jupyter/

# 7. Verify nothing remains
which conda
which python3
Warning: Removing conda deletes all environments and installed packages. Make sure to export any environments you want to recreate later.

10. Automate Conda Cleanup

Add a weekly cleanup to your crontab or create an alias:

# Add to ~/.zshrc for a convenient alias
alias conda-cleanup='conda clean --all -y && echo "Conda cache cleaned!"'

# Or create a full cleanup script
cat << 'EOF' > ~/scripts/conda_cleanup.sh
#!/bin/bash
echo "=== Conda Cleanup ==="
echo "Before:"
du -sh ~/miniconda3/ 2>/dev/null || du -sh ~/anaconda3/ 2>/dev/null

# Clean all caches
conda clean --all -y

# Report stale environments
echo ""
echo "=== Environments (check for unused) ==="
for env_dir in ~/miniconda3/envs/*/; do
    [ -d "$env_dir" ] || continue
    name=$(basename "$env_dir")
    size=$(du -sh "$env_dir" 2>/dev/null | awk '{print $1}')
    echo "  $size  $name"
done | sort -hr

echo ""
echo "After:"
du -sh ~/miniconda3/ 2>/dev/null || du -sh ~/anaconda3/ 2>/dev/null
echo "Done!"
EOF
chmod +x ~/scripts/conda_cleanup.sh

Scheduled Cleanup with cron

# Run conda clean weekly (every Sunday at 3am)
crontab -e
# Add this line:
0 3 * * 0 /Users/$(whoami)/miniconda3/bin/conda clean --all -y >> /tmp/conda_cleanup.log 2>&1

Monitor All Developer Caches in Real-Time

Conda is just one of 44+ developer cache paths that ClearDisk monitors. See your total developer disk usage — including pip, Docker, Xcode, Homebrew, node_modules, and more — right from the menu bar.

Get ClearDisk (Free & Open Source)

11. Quick Reference Cheatsheet

TaskCommand
Full conda disk audit du -sh ~/miniconda3/ ~/anaconda3/ 2>/dev/null
Clean all caches conda clean --all -y
Preview cleanup conda clean --all --dry-run
Clean only tarballs conda clean --tarballs -y
List environments conda env list
Remove environment conda env remove -n env_name
Export environment conda env export -n env_name > backup.yml
Recreate environment conda env create -f backup.yml
Package cache size du -sh ~/miniconda3/pkgs/
Clean index cache conda clean -i -y
Mamba cleanup mamba clean --all -y
Jupyter kernels jupyter kernelspec list
Remove Jupyter kernel jupyter kernelspec uninstall kernel_name
GUI monitoring (all caches) brew tap bysiber/cleardisk && brew install --cask cleardisk

12. FAQ

Is conda clean --all safe to run?

Yes. It only removes cached downloads (tarballs), unused extracted packages, and index metadata. Your active environments and installed packages are never touched. You can verify with conda clean --all --dry-run first.

Why does conda use so much disk space compared to pip?

Conda environments are fully isolated — each one gets its own copy of Python, NumPy, and every dependency. Pip with virtualenvs shares more between environments. Additionally, conda caches both compressed archives and extracted packages in pkgs/, doubling the cache footprint.

Should I switch from Anaconda to Miniconda?

If disk space is a concern, yes. The Anaconda distribution includes 250+ packages that many users never touch. Miniconda starts minimal and lets you install only what you need. The savings are typically 4-5GB on the base install alone.

Will cleaning the cache slow down future installs?

Only slightly. Cleaned packages will need to be re-downloaded if you install them again. On a modern internet connection, this adds a few seconds per package. The disk space savings (often 5-10GB) are usually worth it.

How do I clean conda caches on a CI runner?

Add conda clean --all -y as a post-job step. On GitHub Actions, also consider using the setup-miniconda action with auto-activate-base: false and caching only the environment directory, not the full conda installation. See our CI Runner Cleanup Guide for more details.

Can ClearDisk monitor conda caches?

Yes. ClearDisk monitors 44+ developer cache paths on macOS, including conda/miniconda directories, pip cache, and other Python-related paths. It runs as a menu bar app and shows real-time disk usage for all developer caches.