Do you use Homebrew on macOS? And are you in trouble with low disc space?
Then just try
Since brew does not automatically remove old formulae, your installed packages pile up and press your disc.
Following the official FAQ, I tried
brew cleanup and got about 4 GB of free space in my case.
The official page introduces very few samples.
# remove a formula $ brew cleanup <formula> # clean up everything at once $ brew cleanup # see what would be cleaned up $ brew cleanup -n
For further information, let's see help.
$ brew cleanup -h brew cleanup [--prune=days] [--dry-run] [-s] [formulae]: For all installed or specific formulae, remove any older versions from the cellar. In addition, old downloads from the Homebrew download-cache are deleted. If --prune=days is specified, remove all cache files older than days. If --dry-run or -n is passed, show what would be removed, but do not actually remove anything. If -s is passed, scrub the cache, removing downloads for even the latest versions of formulae. Note downloads for any installed formulae will still not be deleted. If you want to delete those too: rm -rf $(brew --cache)
Now we got something new.
--prune=dayscan destroy caches N days or earlier. Although it lacks description about a case when we omit this option, it defaults to 14 days by reading code.
-nis an abbreviation of
- we can clean up even the latest formula with
If you want to dive into it more, reading code is the best way.