yarn cache clean: how to clear Yarn cache on Mac
It’s safe to clear Yarn cache on a Mac with yarn cache clean: the cache holds copies of packages Yarn has downloaded, and your projects and their node_modules stay. The command and the cache folder differ between Yarn 1 (Classic) and Yarn 2 and later, so this guide covers both, starting with how to tell which one you have.

- Open MacWashing and choose System Junk in the sidebar.
- Click Start Scan.
- Look through what it found and click Clean. Anything debatable stays unchecked.
Free trial · macOS 14 or later
Which Yarn do you have?
Yarn 2 and later are chosen per project, so run this in the project folder:
yarn --version
- 1.x — Yarn 1, also called Yarn Classic. It keeps one cache for all projects.
- 2.x, 3.x, 4.x — modern Yarn. It has a shared cache and can keep a cache inside the project too.
How to clear Yarn cache in Yarn 1 (Classic)
Yarn 1 keeps its cache in your home folder, on a Mac usually in ~/Library/Caches/Yarn. This command shows the exact path:
yarn cache dir
This command deletes the whole cache. Yarn fills it again on the next yarn install:
yarn cache cleanTo remove only some packages from the cache, add their names: yarn cache clean lodash.
How to clear Yarn cache in Yarn 2 and later
Modern Yarn keeps a shared cache for all projects in ~/.yarn/berry, and a project can also have its own cache in .yarn/cache. In a project folder, this command deletes both:
yarn cache clean --allWithout options, yarn cache clean deletes only the project’s own cache. With --mirror it deletes only the shared cache.
Some projects keep .yarn/cache in Git so they work without an install (Zero-Installs). There the cache is part of the repository: use yarn cache clean --mirror, which leaves the project’s cache alone.
What stays after clearing
- Your projects, their
node_modulesandyarn.lock. - Yarn itself and its settings.
- The next install of each package is slower and needs the internet, because Yarn downloads it again.
Each project’s node_modules usually takes more space than the cache: see how to find and delete node_modules.
With MacWashing, it’s one click

System Junk in MacWashing shows the Yarn cache by name under App Caches, with its size. It is left unchecked, because downloading every package again takes time: tick it when you want it removed together with the caches of your other apps.
Free trial · macOS 14 or later
Questions and answers
Will MacWashing delete my own files when it cleans?
No. It removes only what it can match to a known app or a known kind of junk, in places apps leave files; macOS and Apple’s files are never touched. Anything debatable is marked and stays unchecked until you decide.
What about apps that are open?
If an open app holds files being cleaned, MacWashing waits for it to quit or quits it at your request, and opens it again afterwards.
Is it free?
Yes, within the free trial: System Junk and the Uninstaller free up to 25 GB in total, with no account or card needed.
Is it safe to run yarn cache clean?
Yes. The cache holds copies of packages Yarn can download again. Projects keep working, only the next install is slower.
Why did yarn cache clean free almost nothing?
In Yarn 2 and later, the command without options clears only the project’s own cache, while packages are usually kept in the shared cache. Run yarn cache clean --all.
Why does the Yarn cache grow back?
Yarn adds every package version it downloads. A cache that grows fast belongs to projects you install often. Clear it when you need the space.