Diskzyv0.1
Delete with care

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

Short answer

You can remove Node.js versions you no longer use, but do it with nvm and keep the ones your projects need. Each version also carries its own globally installed packages, which go with it.

Where it is

~/.nvm/versions/node

What it is

nvm, the Node Version Manager, installs each version of Node.js into its own folder under ~/.nvm/versions/node. Switching versions with nvm use only changes which of those folders your shell points to.

Each version has its own copy of npm and its own set of global packages, the ones you installed with npm install -g while that version was active. They are stored inside that version's folder.

It grows because installing a new version never removes the old ones. After a few years of upgrades, a Mac can hold many versions nobody uses any more.

How big it gets

Each version takes roughly a hundred to a few hundred MB, and more with many global packages installed.

How to clear it by hand

  1. Run the command below in a shell where nvm is loaded. It lists every installed version and shows which one is current and which is the default.
  2. Check which versions your projects ask for, for example in an .nvmrc file or the engines field of package.json.
  3. Remove a version you do not need with nvm uninstall followed by the version number. nvm will not remove the version that is currently active, so switch to another first.
  4. To clear the downloads nvm keeps from past installs, run nvm cache clear.
In Terminal
nvm ls

What happens afterwards

The removed version and its global packages are gone. You can install it again at any time with nvm install, and you would have to reinstall any global packages you still want.

How Diskzy handles it

Diskzy shows ~/.nvm on the disk map with the size of each Node.js version, so you can see which old ones are worth removing with nvm.

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日本語