Diskzyv0.1
Delete with care

What is ~/.pyenv/versions on Mac? Can you delete old versions?

Short answer

You can remove Python versions you no longer use, but do it with pyenv and check what depends on them first. Each version holds its own installed packages, and virtual environments built on it stop working when it goes.

Where it is

~/.pyenv/versions

What it is

pyenv installs each version of Python into its own folder in ~/.pyenv/versions. On a Mac it normally compiles Python from source, so each folder is a complete, separate Python.

Packages you install with pip while a version is active go into that version's folder. If you use the pyenv-virtualenv plugin, your virtual environments are stored there as well.

It grows because new versions are added next to old ones and nothing removes them. Environments with large packages, such as data science libraries, make individual versions much bigger.

How big it gets

Each plain version takes a few hundred MB. Versions or environments with many packages installed can reach several GB.

How to clear it by hand

  1. Run the command below to list the installed versions and environments. The one marked with an asterisk is active in the current folder.
  2. Check which versions your projects use, for example in a .python-version file.
  3. Remove one you do not need with pyenv uninstall followed by its name, exactly as shown in the list.
  4. Virtual environments you created elsewhere from a removed version stop working and have to be created again from another version.
In Terminal
pyenv versions

What happens afterwards

The removed version and every package installed in it are gone. You can build it again with pyenv install, which takes a few minutes, and then reinstall the packages you need.

How Diskzy handles it

Diskzy shows ~/.pyenv on the disk map with the size of each version, so the heavy ones are easy to find. Project virtual environments are found separately in the Clean up tab as project build folders.

Related guides

See where your Mac's space went

Diskzy maps your disk, explains System Data and clears what's safe. Free for 72 hours, then $9 once for 2 Macs.

Try Diskzy for free
Read this in:EnglishEspañolDeutschPortuguêsFrançaisTürkçe日本語