Cross-Platform & Packages7 min readUpdated 2026-12-04Typical savings: 15–100+ GB

How to Clean node_modules, Rust Cargo, Python uv/Conda & Homebrew on Mac

Reclaim 15–100 GB on Mac from stale node_modules, Rust Cargo target, Python uv/pip/Conda caches, Homebrew bottles, Flutter & Playwright browsers.

Quick answer

Full-stack Mac developers accumulate tens of gigabytes across two layers: per-project build folders (node_modules, Rust target/, Python .venv/, Next.js .next/, Pods/, Flutter build/) and global package stores (Homebrew downloads & old Cellar versions, ~/.cargo/registry, ~/.rustup/toolchains, uv/pip/Conda caches, pnpm/Yarn/npm stores, and old Playwright/Cypress browsers). Almost all regenerate or re-download cleanly.

Typical reclaimable space
15–100+ GB
Safe project folders
node_modules, target, .venv, build, .next, .turbo, Pods, .dart_tool, .build
Safe global caches
Homebrew downloads, uv/pip/Poetry/Ruff, Cargo registry, Playwright old revisions
Protect before deleting
Default Rustup toolchain, active Conda envs, folders named build/target without a manifest

Exact macOS paths & safety reference

Every directory below is verified against real macOS developer toolchains. Check the safety level before deleting anything manually.

LocationmacOS PathTypical SizeSafetyWhat happens when deleted
Stale Project Build Foldersnode_modules, target, .venv, build, .next, Pods, .dart_tool, .build5–60 GBRe-downloadRestored via npm/pnpm install, cargo build, uv sync, flutter pub get, or pod install.
npm, pnpm, Yarn, Bun & Node Managers~/.npm, ~/Library/pnpm/store, ~/Library/Caches/Yarn, ~/.bun, ~/.nvm2–20 GBRe-downloadPackage caches re-download on install; older Node versions can be reinstalled via nvm/fnm/mise.
Homebrew Cache & Old Cellar Versions~/Library/Caches/Homebrew & /opt/homebrew/Cellar2–15 GBRe-downloadEquivalent to brew cleanup; never touches active linked formula versions.
Rust Cargo Registry & Rustup Toolchains~/.cargo/{registry,git} & ~/.rustup/toolchains3–20 GBRe-downloadCrates re-download on build; keep your default and project-pinned Rustup toolchains.
Python uv, pip, Poetry & Conda~/Library/Caches/{uv,pip,pypoetry}, ~/.local/share/uv/python, ~/*conda*/{pkgs,envs}3–25 GBRe-downloadWheel caches and Conda pkgs re-download safely; review Conda envs before removing.
Playwright, Puppeteer, Cypress & Electron~/Library/Caches/{ms-playwright,Cypress,electron} & ~/.cache/puppeteer2–12 GBRe-downloadTest runners download fresh browser revisions on upgrade and leave old revisions behind.
Flutter SDKs, Dart Pub & React Native*/flutter/bin/cache, ~/.pub-cache, ~/.dartServer, $TMPDIR/metro-*3–18 GBRe-downloadFlutter engine caches and Metro caches rebuild automatically on next run.

1. Clean stale per-project build folders without touching source code

A single Rust workspace target/ directory easily reaches 5–15 GB, and a dozen inactive JavaScript repos each carry 400 MB–1.5 GB of node_modules plus .next or .turbo caches. The key rule for safety is manifest verification: only treat a folder named build, target, or .venv as generated output when a matching project file (Cargo.toml, pom.xml, package.json, pubspec.yaml, pyproject.toml, Package.swift, or build.gradle) sits directly next to it.

Find large node_modules & Rust target folders in ~/Developer
find ~/Developer -maxdepth 4 -type d \( -name node_modules -o -name target -o -name .venv \) -prune -exec du -sh {} + 2>/dev/null | sort -hr

2. Run targeted global cache cleanups for Brew, Cargo, and Python

Package managers optimize for offline reinstalls by keeping downloaded tarballs, wheels, bottles, and older toolchain revisions forever unless told to prune them:

Safe CLI cleanup commands across Homebrew, uv, pip, Conda & pnpm
brew cleanup --prune=all
uv cache prune
pip cache purge
conda clean --all
pnpm store prune
rustup toolchain list

Note: Check rustup toolchain list before running rustup toolchain uninstall — never remove the active default toolchain.

3. Don't forget Playwright, Puppeteer, Cypress & Flutter engine caches

End-to-end test frameworks download full Chromium, Firefox, and WebKit binaries (~300–500 MB per browser) on every version bump and rarely delete old revisions from ~/Library/Caches/ms-playwright, ~/.cache/puppeteer, or ~/Library/Caches/Cypress.

Similarly, every Flutter SDK stores ~3 GB of engine binaries in bin/cache, and version managers like FVM, asdf, or mise can leave multiple 3+ GB SDK copies sitting side by side.

Frequently asked questions

Is it safe to delete Rust Cargo target/ folders and ~/.cargo/registry?

Yes. Both target/ (compiled build artifacts next to Cargo.toml) and ~/.cargo/registry/{cache,src} regenerate on the next cargo build. Only your first rebuild will take longer while crates recompile.

How much space does uv cache use on macOS, and is it safe to clear?

uv caches wheels and unpacked archives in ~/Library/Caches/uv (or $UV_CACHE_DIR) and can easily grow to 5–15 GB across Python projects. Clearing it is completely safe; uv re-downloads wheels on the next uv sync.

Will deleting pnpm's global store break existing node_modules?

pnpm hard-links files from its store into each project's node_modules. Deleting the store directory unlinks the store's references while keeping existing project hard-links valid on APFS, though running pnpm store prune or deleting unused project node_modules first is cleaner.