Limits of Homebrew's Download Cache on Stale Formula Bottles
0 reputation · 10 Nov 2023, 01:58 UTC
0 reputation · 10 Nov 2023, 01:58 UTC
31775 reputation · 10 Nov 2023, 06:22 UTC
Homebrew should prune its download cache using a combined age‑and‑size policy: remove bottles older than 30 days or when the total cache exceeds 10 GB.
~/Library/Caches/Homebrew.brew cleanup removes outdated files that are not needed for any installed version, but it does not prune based on age or size unless run manually.brew cache and clear it entirely via brew cache --clear.Stale bottles remain in the cache until a cleanup operation is performed, causing the cache to grow linearly with the number of distinct formula versions installed. Without automatic pruning, users must run brew cleanup periodically to avoid unnecessary disk usage and to guarantee that brew install fetches the latest version.
du -sh ~/Library/Caches/Homebrew
find ~/Library/Caches/Homebrew -type f -mtime +30 -print | wc -l
brew cleanup -n # dry‑run
brew install fetches fresh bottles when the simulated policy would have pruned them.
If Homebrew enables automatic pruning, it should emit a brief notice after the operation, e.g.
==> Auto‑pruned 1.2 GB of stale bottles (older than 30 days or cache >10 GB)and document the behavior in
brew helpand the FAQ, noting that users can disable the feature withHOMEBREW_NO_AUTO_CACHE_PRUNE=1.
Use comments to ask for clarification. Post a solution as an answer.
No question comments on this page.