Diskzyv0.1
Safe to delete

What is the Yarn cache on Mac, and is it safe to delete?

Short answer

Yes, the Yarn cache is safe to delete. It holds copies of downloaded packages, and Yarn downloads them again when a project needs them.

Where it is

~/Library/Caches/Yarn

What it is

Yarn saves every package it downloads so that the next install of the same version does not need the network. Yarn 1, also called Yarn Classic, keeps this cache in ~/Library/Caches/Yarn on a Mac.

Newer Yarn versions store their cache differently, either in a global folder in your home directory or inside each project, depending on configuration. The same clean command works for them.

Like other package caches, it keeps every version you have ever installed and does not trim itself.

How big it gets

Often a few GB if Yarn is your main package manager.

How to clear it by hand

  1. Open Terminal.
  2. Run the command below. On Yarn 1 it deletes the global cache. On newer Yarn versions, run it inside a project and it clears that project's cache.
  3. To see where Yarn 1 keeps its cache, run yarn cache dir.
In Terminal
yarn cache clean

What happens afterwards

Installed projects keep working. The next yarn install downloads packages from the registry again, so it is slower and needs a connection.

How Diskzy handles it

Diskzy lists the Yarn cache in the Clean up tab and ticks it.

Related guides

See where your Mac's space went

Diskzy maps your disk, explains System Data and clears what's safe. Free for 72 hours, then $9 once for 2 Macs.

Try Diskzy for free
Read this in:EnglishEspañolDeutschPortuguêsFrançaisTürkçe日本語