WindowsmacOSLinux

Where Does Yarn Store Its Cache?

Yarn classic cache folder on Windows, macOS and Linux plus the cache dir command and Berry differences.

Last updated

Yarn Classic caches tarballs per user: Local AppData Yarn cache on Windows, Library Caches on Mac, .cache/yarn on Linux. The cache dir command prints yours.

Yarn Berry (v2+) works differently with per project .yarn/cache check-ins. Check the version first; the two generations share almost nothing.

Where Yarn stores this, by platform

Windows
%LOCALAPPDATA%\Yarn\Cache

Classic default. Berry projects keep .yarn/cache inside the repo instead of any global folder.

macOS
~/Library/Caches/Yarn

Classic default. Print with the cache dir command when versions or prefixes moved it.

Linux
~/.cache/yarn

Classic default honoring XDG cache home. YARN_CACHE_FOLDER env var overrides all three OS paths.

Frequently asked questions

How do I clear the Yarn cache?

Run the cache clean command for Classic. Berry users prune the project .yarn/cache or run yarn install fresh.

Classic or Berry: which paths apply to me?

Check the version output. v1 uses the global cache folders above; v2+ uses project local .yarn storage.

Notice an outdated path? Let us know.