OptiClear

Developer Tools

Clear Yarn Cache on Mac

Clearing the Yarn cache frees space and often fixes installs that pull in corrupt packages. Yarn rebuilds the cache on its own as you work, and your project files stay where they are.

Last updated: 2 min read

Clear the Yarn cache without guessing

Yarn data usually takes 500 MB – 10 GB on a Mac. The free scan shows the exact size on your Mac before you change anything.

Scan your Mac free

Free scan · No account · Nothing is deleted without your OK · Moves to the Trash first · macOS 14+

Application
Yarn
Typical data size
500 MB – 10 GB
Category
Developer Tools
File Location
~/Library/Caches/Yarn

Clear it from inside Yarn first

The safest way is the option built into the app: yarn cache clean empties the Yarn 1 cache; on Yarn 2 and later it cleans the project cache, and yarn cache clean --mirror also empties the global cache. Project node_modules are not touched.

Yarn cache folders you can clear

These folders are rebuilt automatically, so removing them does not touch your own files.

Locations are the standard macOS folders Yarn uses; some appear only after you use the matching feature.

What the Yarn cache holds and when clearing it helps

Specific to Yarn

The cache folders listed in the table above hold downloaded copies of packages, not your projects. The classic version and newer versions keep separate caches, so a Mac that has used both has two of them. Clearing helps when the cache has grown to several gigabytes or when installs keep picking up corrupt packages. Project dependencies live in node_modules or the project .yarn folder, not in the global cache, so they are not part of what gets cleared.

What happens to Yarn after you clear the cache

Yarn rebuilds the cache automatically the next time it needs a package, so it fills back in as you install. Your first install or start afterwards will be slower because packages must be downloaded again. You do not need to sign in again, since an account is only needed to publish packages. Your project files and node_modules are left alone, and the app stays installed and ready to use.

0 of 4 done

Account and sync
An npm registry account is only needed to publish packages.

Try it without risk

  1. Download and scan for freeSee every Yarn file and its size. No account needed.
  2. Clean free for 7 daysStart the 7-day free trial of the yearly plan inside the app.
  3. Keep it or cancelCancel in your App Store settings at least 24 hours before the trial ends and you won't be charged.
Download free and scan

After the free trial, Pro costs $39.99 per year in your country's App Store; cancel any time.

Frequently asked questions

Yes. Folders marked “Yes, rebuilt automatically” are rebuilt automatically; removing them only makes the next start slower.
Do I need to reinstall the app after clearing the cache?
No. Clearing the cache only empties downloaded package copies, and the app keeps working as before.
Will clearing the cache affect my project's node_modules?
No. The clean command does not touch project node_modules, and the cache refills as you install.

Related cleanup guides