DiskwiseGet it for life$24

Clear your package managers’ caches

Last updated November 21, 2026

Package managers keep a copy of every package they download, so the next install is quicker, and most never throw any away. Each cache here is safe to clear: the next install downloads what it needs again, a little slower the first time.

Where they are

  • npm cacheSafe to clear
    ~/.npm/_cacacheEvery package npm has downloaded. Refills on the next install.
  • npx cacheSafe to clear
    ~/.npm/_npxTools npx fetched to run once.
  • pnpm storeRebuildable
    ~/Library/pnpm/storeThe one copy of each package your pnpm projects link to. Pruning keeps the ones a project still uses.
  • Yarn cacheSafe to clear
    ~/Library/Caches/YarnYarn 1’s cache. Yarn 2 and later keep theirs in ~/.yarn/berry/cache. Both refill on the next install.
  • Bun cacheSafe to clear
    ~/.bun/install/cacheRefills on the next install.
  • pip cacheSafe to clear
    ~/Library/Caches/pipPython packages pip downloaded or built. Refills on the next install.
  • Cargo download cacheSafe to clear
    ~/.cargo/registry/cacheCrates Cargo downloaded. Refills on the next build.
  • Gradle cacheSafe to clear
    ~/.gradle/cachesDependencies and build caches. Refills on the next build.
  • CocoaPods cacheSafe to clear
    ~/Library/Caches/CocoaPodsRefills on the next pod install.
  • Playwright browsersRebuildable
    ~/Library/Caches/ms-playwrightThe browsers Playwright runs tests in. Downloaded again by your next test run.

The groups are the ones Diskwise sorts these into: Safe to clear refills on its own, Rebuildable comes back with the next build or install, and Your call is yours to judge.

Clear each one

Each tool has its own command, which clears its cache without touching your projects.

npm

Terminal
npm cache clean --force

npm asks for --force because its cache repairs itself and rarely needs clearing. npm cache verify is the gentler choice: it removes what npm no longer needs and checks the rest.

npx

Terminal
rm -rf ~/.npm/_npx

Run it while no npx command is running. npx fetches a tool again the next time you use it.

pnpm

Terminal
pnpm store prune

It removes the packages no project on your Mac uses now, and the projects you’ve installed keep working. pnpm store path shows where your store is.

Yarn

Terminal
yarn cache clean

That clears Yarn 1’s cache. In a project on Yarn 2 or later, run yarn cache clean --mirror instead: it clears the shared cache in ~/.yarn/berry/cache and leaves the project’s own alone.

Bun

Terminal
bun pm cache rm

pip

Terminal
python3 -m pip cache purge

Every Python on your Mac shares this cache, unless one was set up to keep its own.

Cargo

Terminal
rm -rf ~/.cargo/registry/cache

Cargo downloads the crates a build needs again.

Gradle

Stop Gradle’s background daemons first, with ./gradlew --stop in a project or gradle --stop, then:

Terminal
rm -rf ~/.gradle/caches

CocoaPods

Terminal
pod cache clean --all

Playwright

Terminal
npx playwright uninstall --all

It removes the browsers of every Playwright install on your Mac. npx playwright install in a project brings back the ones it needs.

How Diskwise handles them

Diskwise’s free scan finds every cache above, and those of other tools like uv, Turborepo and Prisma. A cache you haven’t used for a month says “Unused since” and the day, so you can see which ones cost nothing to clear.

The caches are Safe to clear. The pnpm store and the browsers Playwright and Puppeteer download are Rebuildable, since they take longer to come back. Tools npx is running right now are kept, and auto clean only ever clears what costs nothing: caches of tools you haven’t used in a month, and leftovers.

Rather not do it by hand?

Diskwise finds what fills your Mac, from build data to caches, sizes it honestly and clears what’s safe in one click. The scan is free.