Merged
Conversation
Yarn v1 stores its global cache at ~/Library/Caches/Yarn/ on macOS, which is separate from the ~/.yarn/cache/ path used by Yarn v2+. This cache can grow to several gigabytes and is not cleaned by `yarn cache clean` when Yarn v2+ is the active version.
ijusti
approved these changes
Apr 23, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
~/Library/Caches/Yarn/inclean_dev_npm()~/.yarn/cache/*only covers Yarn v2+ (Berry), missing the Yarn v1 (Classic) cache path on macOSmo cleanSafety Review
safe_cleantarget to the existingclean_dev_npm()function.safe_cleanmechanism as all other cache paths, which respects whitelist and dry-run modes.~/Library/Caches/Yarn/*is a well-known macOS cache directory used exclusively by Yarn v1. It contains downloaded package tarballs that are re-fetched on demand, so deletion is safe and non-destructive.Tests
~/Library/Caches/Yarn/exists on a macOS machine that has used Yarn v1mo clean --dry-rundoes not currently list this path--dry-runare respected (uses existingsafe_cleanhelper)Safety-related changes
safe_cleanfunction as all other cache cleanup targets.