CleanMate

All guides · macOS and Ubuntu · Updated

Old Node, Python, Ruby, Rust and Go versions filling your disk: nvm, pyenv, rbenv, rustup, Go SDK and fvm on Mac and Ubuntu

How to list and remove the language versions you no longer use on a Mac or on Ubuntu: nvm ls and nvm uninstall, pyenv versions, rbenv, rustup toolchain remove, Go SDKs in ~/sdk and fvm, and how to tell which version a project pins.

Download for macOS · Install on Ubuntu — free and open source

CleanMate on a Mac after a Smart Scan cleanup of old Node, Python and other runtime versions, showing the space freedCleanMate on a Mac after a Smart Scan cleanup of old Node, Python and other runtime versions, showing the space freed

Version managers install a new version next to the old ones and never remove anything. A few years of nvm install --lts, pyenv install, rustup update and Flutter upgrades leave a dozen Node versions (100 to 200 MB each), several Pythons and Rubys (0.3 to 2 GB each), Rust toolchains and Flutter SDKs (1 to 2 GB each). None of them is a cache: they are the real tools, so remove them with care.

The rule is the same for every tool: keep the version you use by default and every version a project pins. Removing a version a project needs only costs a reinstall.

Which version does a project pin?

Projects name their version in a small file at their root:

Search for them before you delete (replace ~/Developer with where your projects live):

find ~/Developer -maxdepth 4 \( -name .nvmrc -o -name .node-version -o -name .python-version -o -name .ruby-version -o -name rust-toolchain.toml -o -name .fvmrc \) -not -path '*/node_modules/*' 2>/dev/null

Node.js: nvm

Versions live in ~/.nvm/versions/node on a Mac and on Ubuntu.

nvm ls
nvm alias default        # the version a new terminal uses
nvm uninstall 18.20.4

nvm uninstall refuses to remove the version you are using now (nvm use another one first). Keep the version default points to.

Python: pyenv

pyenv versions
cat ~/.pyenv/version          # global version(s)
pyenv uninstall 3.9.18

Before you uninstall a version, check that no virtualenv lives inside it: ls ~/.pyenv/versions/<version>/envs. Virtualenvs made with pyenv virtualenv are in that folder and go with the version.

Ruby: rbenv

rbenv versions
cat ~/.rbenv/version             # global version
rbenv uninstall 3.1.4

Rust: rustup

rustup toolchain list
rustup default                  # the default toolchain
rustup toolchain remove nightly-2024-01-01

Directory overrides (rustup override list) and rust-toolchain.toml files name toolchains projects need. rustup toolchain remove of a name a project pins makes rustup download it again at the next build.

Go: SDKs in ~/sdk

Versions installed with go install golang.org/dl/go1.21.0@latest and go1.21.0 download live in ~/sdk/go<version>. Check which Go you run (which go, go env GOROOT) and remove the others:

ls ~/sdk
rm -r ~/sdk/go1.21.0

Since Go 1.21 a go command can also download a toolchain a go.mod asks for. Those are Go modules under ~/go/pkg/mod/golang.org/toolchain@...; go clean -modcache removes them with the rest of the module cache, and the next build downloads again what it needs.

Flutter: fvm

Each Flutter SDK is in ~/fvm/versions (or FVM_CACHE_PATH), 1 to 2 GB each.

fvm list
fvm global                       # the global version
fvm remove 3.19.6

On Ubuntu, SDKMAN (sdk list java, sdk uninstall java 17.0.2-tem) keeps Java, Kotlin and Gradle versions the same way.

How CleanMate does it

CleanMate lists the versions of these tools in Smart Scan, each with its size, on a Mac (all macOS features) and on Ubuntu (all Ubuntu features). The items are never ticked for you and nothing is removed until you confirm. They are deleted rather than moved to the Trash, because nvm install, pyenv install and the like install a version again.

What it keeps: the default version (nvm’s alias/default, on Ubuntu also every version one of your own nvm aliases names, fvm’s global version, the pyenv version file and the rbenv version file, the default rustup toolchain and every directory override, the Go SDK your go command runs from), a version your PATH runs from, and a pyenv version that holds virtualenvs. A version a program runs from right now is shown as locked with the reason. If CleanMate cannot work out the default of a tool (no version file, no default toolchain), it lists nothing for that tool. For nvm, no alias/default means nothing is listed on both systems; on macOS, a default of system lists every Node version. For fvm, no global version means every Flutter SDK is listed on macOS and nothing on Ubuntu.

CleanMate does not read project files such as .nvmrc, .python-version or rust-toolchain.toml; it never touches them. A version only a project pins can appear in the list. If you keep projects that need an older version, untick it, or reinstall it after the cleanup.

If your disk is still full, see Free up disk space on a Mac as a developer or on Ubuntu, the package caches the toolchains leave behind (Rust, Go and Java package caches), old Unity Editor versions (Unity using too much disk space), and for the apps themselves chat app caches. To compare CleanMate with other cleaners, see the comparison.

For mobile projects, see Flutter, React Native and the iOS Simulator filling your Mac.

FAQ

Is it safe to delete old Node versions installed with nvm? Yes, if you do not need them. nvm install <version> installs one again. Keep the default version and any version a project pins in .nvmrc.

How much space do old runtimes take? About 100 to 200 MB per Node version, 0.3 to 2 GB per Python, Ruby or Go version, and 1 to 2 GB per Rust toolchain or Flutter SDK.

Will deleting a pyenv version break my virtualenvs? Yes, a virtualenv made from that version stops working. Check ~/.pyenv/versions/<version>/envs first, or recreate the environment afterwards.

Does rustup update remove the old toolchain? It updates the toolchain in place, so stable does not pile up. Pinned dated toolchains and nightlies you installed stay until you remove them.

Skip the commands

CleanMate runs on both systems: pick yours.

Open source — star it on GitHub: CleanMate for macOS · CleanMate for Ubuntu

How CleanMate decides what is safe to remove →