Yarn cache: is it safe to delete?
The download cache that the Yarn package manager keeps on macOS.
- Where it lives
~/Library/Caches/Yarn
- Risk
- Low risk. The tool rebuilds it when needed, so SPACE256 preselects it in Review.
- Comes back on its own
- Yes
- If you delete it
- The next yarn install downloads its packages again and cannot work offline until it has.
- What SPACE256 does
- Runs the tool's own cleanup command, only after the tool reports this exact folder, after you confirm in Review with a press and hold.
Cleaned with the tool's own command
yarn cache clean
What it is
Yarn 1 (Classic) keeps every package it downloads in ~/Library/Caches/Yarn, so later installs can copy packages from disk instead of the network. yarn cache dir prints the folder Yarn uses on your Mac.
Why it grows
Like npm, Yarn keeps every version it has ever downloaded and doesn’t remove old ones on its own. Long-lived Macs with many projects collect a lot of them. Monorepos and projects with large dependency trees add thousands of packages at once.
When to clear it
When you need space and can download packages for your next install.
When to keep it
Before working offline, since an empty cache means the next yarn install needs the network.
How SPACE256 clears it
SPACE256 runs Yarn’s own yarn cache clean, after Yarn reports this exact folder as its cache.
Questions
Does clearing the Yarn cache affect my projects?
No. Projects keep their node_modules. Yarn downloads packages again the next time an install needs one that is no longer cached.
Is this the cache of Yarn 1 or of newer Yarn?
This folder belongs to Yarn 1 (Classic) on macOS. Yarn 2 and later keep a separate global cache, covered in its own guide.