It’s probably because there is nothing to clean up.
Especially if you’ve only had Homebrew for 1 day.
I want to clear my computer of any extra useless copies of Homebrew.
That’s not what brew cleanup
is for. It’s for deleting old and unused files downloaded by Homebrew during brew install
. It’s not for clearing old versions of Homebrew (that is automatically done when you do brew update
).
~$ brew cleanup --help
Usage: brew cleanup [options] [formula|cask]
Remove stale lock files and outdated downloads for all formulae and casks, and
remove old versions of installed formulae. If arguments are specified, only do
this for the given formulae and casks. Removes all downloads more than 120 days
old. This can be adjusted with HOMEBREW_CLEANUP_MAX_AGE_DAYS.
--prune Remove all cache files older than specified
days.
-n, --dry-run Show what would be removed, but do not
actually remove anything.
-s Scrub the cache, including downloads for
even the latest versions. Note downloads
for any installed formulae or casks will
still not be deleted. If you want to delete
those too: rm -rf "$(brew --cache)"
--prune-prefix Only prune the symlinks and directories
from the prefix and remove no other files.
Notice the part of “Removes all downloads more than 120 days
old.“. If you haven’t installed that many things with Homebrew and/or you have not been using it for a long time, then it’s expected that there is nothing to clean up. Also, even with the -s
option, Homebrew does not delete files for “any installed formulae or casks“.
Try installing and uninstall something, then do brew cleanup
:
~$ brew install grep amazon-ecs-cli iterm2
...
~$ brew cleanup -s -n
~$
~$ brew uninstall grep amazon-ecs-cli iterm2
Uninstalling /usr/local/Cellar/grep/3.6... (21 files, 964.6KB)
Uninstalling /usr/local/Cellar/amazon-ecs-cli/1.21.0... (7 files, 46.2MB)
==> Uninstalling Cask iterm2
==> Backing App 'iTerm.app' up to '/usr/local/Caskroom/iterm2/3.4.3/iTerm.app'.
==> Removing App '/Applications/iTerm.app'.
==> Purging files for version 3.4.3 of Cask iterm2
~$ brew cleanup -s -n
Would remove: /Users/me/Library/Caches/Homebrew/amazon-ecs-cli--1.21.0.catalina.bottle.tar.gz (14.8MB)
Would remove: /Users/me/Library/Caches/Homebrew/grep--3.6.catalina.bottle.tar.gz (330.8KB)
Would remove: /Users/me/Library/Caches/Homebrew/Cask/iterm2--3.4.3.zip (21.3MB)
==> This operation would free approximately 36.4MB of disk space.
Notice that doing brew cleanup
while those formulae are installed, it does not show any output. Only when they are uninstalled does it become something to clean.
Or try passing in the --prune=1
option (remove all cache files older than 1 day) and the -s
option (scrub the cache, even for latest versions). On my system where I’ve had Homebrew for years:
~$ brew cleanup --prune=1 -s -n
...
==> This operation would free approximately 1.1GB of disk space.