1. Work out which package manager and version
Yarn 1, often called Yarn classic, and modern Yarn, version 2 and later, store their caches in different places and use different commands. Run yarn --version inside a project: a 1.x number means classic. A packageManager field in package.json, or a .yarnrc.yml file in the project, is another sign the project uses modern Yarn.
pnpm --version confirms pnpm. Clearing the cache of a tool a project does not use frees nothing for that project, so check each project you care about rather than assuming one version across the Mac.
yarn --version
pnpm --version2. Yarn 1: one global cache
Yarn 1 keeps every package it downloads in a single global cache. yarn cache dir prints its location, which on a Mac is usually inside ~/Library/Caches/Yarn, and du measures it. yarn cache list shows what is stored, and its --pattern option filters the list by package name.
yarn cache clean clears the whole cache, and a package name after it clears only that package. The documentation notes the cache is populated again the next time yarn or yarn install runs, so the cost is a slower, network-dependent first install.
yarn cache dir
du -sh "$(yarn cache dir)"
yarn cache clean3. Modern Yarn: a global cache and project caches
Modern Yarn’s enableGlobalCache setting is true by default, which stores cache files in its global folder, ~/.yarn/berry unless configured otherwise. A project that sets enableGlobalCache to false uses its cacheFolder instead, by default .yarn/cache inside the project.
That project cache is often committed to git on purpose, for offline installs or the setup Yarn calls Zero-Installs. Deleting it from a repository shows up as deleted files in version control, so leave a committed .yarn/cache alone. Run yarn cache clean in a project to clear its local cache, --mirror to clear the global cache instead, or --all for both.
du -sh ~/.yarn/berry
yarn cache clean --mirror4. pnpm: one store per disk
pnpm keeps packages in a content-addressable store; pnpm’s documentation gives ~/Library/pnpm/store as the default on macOS, and pnpm store path prints the one in use. The store should be on the same disk as your projects, so pnpm uses one store per disk: projects on an external drive get a separate .pnpm-store folder at the root of that drive.
pnpm store prune removes packages that no project on the system references any more. pnpm describes it as harmless with no side effects on projects, and suggests running it occasionally rather than often, because switching branches can need an unreferenced package again, and pnpm then downloads it.
pnpm store path
du -sh "$(pnpm store path)"
pnpm store pruneCommon questions
How do I know if a project uses Yarn 1 (classic) or modern Yarn?
Run yarn --version: a 1.x number means classic. A packageManager field in package.json or a .yarnrc.yml file signals modern Yarn, version 2 or later, and each version stores and clears its cache differently.
Is it safe to delete a project's committed .yarn/cache folder?
Not if your team commits it to git on purpose, for offline installs or Zero-Installs. Deleting it shows up as deleted files in version control, so leave a committed .yarn/cache alone.
Why doesn't deleting a project's node_modules free much space with pnpm?
pnpm links or clones files from its shared store into each project's node_modules instead of copying them, so the project folder and the store share the same data, and deleting one node_modules frees little on its own.
Can I delete pnpm's store folder directly in Finder?
No. Projects that link into it may then need a full reinstall, and pnpm has no way to know which packages you still wanted. Use pnpm store prune instead to remove only unreferenced packages.
References & further reading
These guides combine the linked official guidance with ClearDisk’s documented behavior. Your files and app settings determine the right next step.