Mac storage basics · Developer tools

How do I clear npm, Yarn and pip caches on a Mac?

Short answer: Run npm cache clean --force, yarn cache clean, pnpm store prune or pip cache purge. They only slow the next install while packages re-download.

Each package manager has its own command:

  • npm: npm cache clean --force
  • Yarn: yarn cache clean
  • pnpm: pnpm store prune
  • pip: pip cache purge

These caches only speed up future installs; clearing them means the next install downloads packages again. Your projects aren't affected.

Storage Studio's Free Up Space includes a developer and package caches step that clears caches like these with a review first. See freeing up space.

Last reviewed

Also available as Markdown and JSON.