Skip to content

How to uninstall Yarn on a Mac, and its two caches

Yarn 1 and Yarn 2 and later cache in different places. On our Mac that was 1.0 GB in Library/Caches/Yarn and 767 MB in ~/.yarn/berry, plus two yarn commands.

4 min read

How do I uninstall Yarn on a Mac?

  1. Find every copy: which -a yarn. Ours had two, /usr/local/bin/yarn and one inside an nvm Node version.
  2. Remove each one: npm uninstall -g yarn under each Node version, brew uninstall yarn, or corepack disable yarn.
  3. Delete both caches: ~/Library/Caches/Yarn and ~/.yarn.
  4. Delete ~/.yarnrc and ~/.yarnrc.yml if they exist.

What does Yarn keep on a Mac?

WhereSize hereWhat it is
~/Library/Caches/Yarn/v61.0 GBYarn 1's package cache
~/.yarn/berry/cache696 MBYarn 2 and later, the global cache
~/.yarn/berry/metadata71 MBPackage metadata
~/.yarnrca few bytesSettings

Why does yarn say this project is configured to use pnpm?

That message comes from Corepack, which reads the packageManager field of the nearest package.json. On our Mac, running yarn --version in the home folder printed it, because a stray package.json sat directly in the home folder. Every folder beneath it inherits that setting. If you see it in a folder that is not a project, look for a package.json in a parent folder.

Find what is left in one look

Free Mac shows both Yarn caches and every node_modules on the Storage map and moves what you pick to the Trash. To keep Yarn and only shrink the caches, see Yarn and pnpm stores.

Related: Homebrew lists apps you already deleted and the Chrome Apps folder.

Common questions

Where is the Yarn cache on a Mac?

Yarn 1 uses ~/Library/Caches/Yarn. Yarn 2 and later use ~/.yarn/berry/cache, or a .yarn/cache folder inside each project.

Is it safe to delete the Yarn cache?

Yes. Packages download again the next time a project installs.

Why is yarn still found after npm uninstall -g yarn?

Another copy is on your PATH, under a different Node version, from Homebrew or from Corepack. which -a yarn lists them.

Read next