What is ~/.pyenv/versions on Mac? Can you delete old versions?
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/versionsWhat 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
- Run the command below to list the installed versions and environments. The one marked with an asterisk is active in the current folder.
- Check which versions your projects use, for example in a .python-version file.
- Remove one you do not need with pyenv uninstall followed by its name, exactly as shown in the list.
- Virtual environments you created elsewhere from a removed version stop working and have to be created again from another version.
pyenv versionsWhat 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
- pip cache~/Library/Caches/pip
- uv cache~/.cache/uv
- Conda package cache~/miniconda3/pkgs (or ~/anaconda3/pkgs)
- nvm versions~/.nvm/versions/node
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