Guide · Python

Delete old Conda environments and free space

Each Conda environment is a full set of packages in its own folder, usually under ~/miniconda3/envs or ~/anaconda3/envs. List them with conda env list, preview with conda remove --name NAME --all --dry-run, then delete with conda env remove --name NAME. Run conda clean --all afterwards to free cached packages.

Why it gets big

A Conda environment holds its own Python and its own copy of every package, which for data science and machine learning often means large libraries like PyTorch, TensorFlow or MKL. Create one per project or per tutorial and they pile up.

Two places take the space:

  • Environments in envs/ inside your Conda install, such as ~/miniconda3/envs, ~/anaconda3/envs or ~/miniforge3/envs.
  • The package cache in pkgs/ inside the same install. Conda keeps every package it downloaded, both the archive and the unpacked copy, even after no environment uses it.

Conda links files from pkgs/ into environments where it can, so the two can share disk space. That is why removing an environment sometimes frees less than its folder size, until you also clean the cache.

How to clear it by hand

1. List environments and their sizes

conda env list
du -sh ~/miniconda3/envs/* | sort -h

Change the path to match your install (anaconda3, miniforge3 and so on).

2. Save the recipe before you delete

conda env export --name old-env --from-history > old-env.yml

--from-history keeps only the packages you asked for, which recreates more reliably than a full list. Later, conda env create -f old-env.yml builds it again.

3. Preview, then remove

conda deactivate
conda remove --name old-env --all --dry-run
conda env remove --name old-env

You cannot remove the environment you are in, so deactivate first. You also cannot remove base. For an environment created with --prefix inside a project, use conda env remove --prefix ./env.

Removing with conda rather than deleting the folder keeps Conda’s own list of environments accurate. With mamba or micromamba, the same commands work with mamba or micromamba in place of conda.

4. Clean the package cache

conda clean --all --dry-run
conda clean --all

This removes package archives, unused unpacked packages and index caches. Packages that environments still use are kept. Anything removed downloads again if an environment needs it later.

  • Safe: conda clean --all, and environments you can recreate from a file.
  • Think first: environments with packages installed by hand, with pip inside them, or pinned to versions that may no longer be available.
  • Leave alone: base. If you want Conda gone entirely, follow the uninstall steps for your distribution.

How Berth handles it

Berth covers the Conda package cache, not environments. It looks for an install in ~/miniconda3, ~/anaconda3, ~/miniforge3, ~/mambaforge, ~/opt/anaconda3 or ~/opt/miniconda3 and measures its pkgs folder.

  • Re-downloadable: the Conda package cache. Packages your environments still link to are kept.

Berth cleans it with that install’s own conda clean --all --yes. That command does not use the Trash, so Undo cannot bring it back; Berth marks it “Can’t be undone” and leaves it out of the “add everything recommended” action. If the conda program is missing, the folder goes to the Trash instead.

Berth does not list, judge or remove Conda environments. It cannot tell which ones you still need, so use conda env remove as above. Explore still shows the envs folder and each environment with its size, so you can see which ones are worth removing. Separately, Berth finds .venv and venv folders inside projects you have not committed to in 90 days or more, as Rebuilds itself.

Whatever Berth finds goes into a review tray first. A dry run shows exactly what would move, pre-flight checks make sure the owning app is closed, and everything goes to the macOS Trash, so Undo puts it back. Berth is free to scan and explore; one-click cleanup is part of Berth Pro, $14.99 one-time for 2 Macs. There is no account and nothing is uploaded.

Questions

How do I delete a Conda environment?

Run conda deactivate, then conda env remove --name NAME. To preview first, run conda remove --name NAME --all --dry-run.

Where are Conda environments stored on a Mac?

In the envs folder of your Conda install, for example ~/miniconda3/envs or ~/anaconda3/envs. conda env list prints the exact paths.

Why did deleting an environment free less space than expected?

Conda shares files between environments and its package cache. Run conda clean --all after removing environments to free the rest.

Is conda clean --all safe?

Yes. It removes cached downloads and packages no environment uses. Your environments keep working, and anything removed downloads again when needed.

Can I get a deleted environment back?

Only by recreating it. Export it first with conda env export --from-history, then use conda env create -f with that file.

Make room.
See what’s filling your Mac.

Free to scan, explore and understand everything on your disk. Berth Pro adds one-click cleanup when you want it.

Find my Conda leftovers, free

Free download · Version 1.0.0 · Signed and notarized by Apple

Berth runs on macOS. Send yourself the link and open it there.