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
~Every package npm has downloaded. Refills on the next install./.npm /_cacache - npx cacheSafe to clear
~Tools npx fetched to run once./.npm /_npx - pnpm storeRebuildable
~The one copy of each package your pnpm projects link to. Pruning keeps the ones a project still uses./Library /pnpm /store - Yarn cacheSafe to clear
~Yarn 1’s cache. Yarn 2 and later keep theirs in/Library /Caches /Yarn ~/.yarn/berry/cache. Both refill on the next install. - Bun cacheSafe to clear
~Refills on the next install./.bun /install /cache - pip cacheSafe to clear
~Python packages pip downloaded or built. Refills on the next install./Library /Caches /pip - Cargo download cacheSafe to clear
~Crates Cargo downloaded. Refills on the next build./.cargo /registry /cache - Gradle cacheSafe to clear
~Dependencies and build caches. Refills on the next build./.gradle /caches - CocoaPods cacheSafe to clear
~Refills on the next pod install./Library /Caches /CocoaPods - Playwright browsersRebuildable
~The browsers Playwright runs tests in. Downloaded again by your next test run./Library /Caches /ms-playwright
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
npm cache clean --forcenpm 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
rm -rf ~ /.npm /_npxRun it while no npx command is running. npx fetches a tool again the next time you use it.
pnpm
pnpm store pruneIt 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
yarn cache cleanThat 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
bun pm cache rmpip
python3 -m pip cache purgeEvery Python on your Mac shares this cache, unless one was set up to keep its own.
Cargo
rm -rf ~ /.cargo /registry /cacheCargo downloads the crates a build needs again.
Gradle
Stop Gradle’s background daemons first, with ./gradlew --stop in a project or gradle --stop, then:
rm -rf ~ /.gradle /cachesCocoaPods
pod cache clean --allPlaywright
npx playwright uninstall --allIt 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.