brew cleanup doesn't clean ~/Library/Caches/Homebrew

Created on 10 Feb 2018  路  6Comments  路  Source: Homebrew/brew

I noticed brew keeps a copy of the files it downloads in ~/Library/Caches/Homebrew , and the "brew doctor" command doesn't clean it.

For example:

[damians@iMac ~]$ brew cleanup
Removing: /usr/local/Cellar/ffmpeg/3.4.1... (248 files, 50.9MB)
Removing: /usr/local/Cellar/x264/r2795... (11 files, 3.2MB)
==> This operation has freed approximately 54.1MB of disk space.

And in the Cache folder there are still:

[damians@iMac ~]$ ls ~/Library/Caches/Homebrew
ffmpeg-3.4.1_1.high_sierra.bottle.tar.gz x264-r2854.high_sierra.bottle.tar.gz

Most helpful comment

The cleanup section of brew鈥檚 man page (emphasis mine):

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)

This is expected behaviour. If you want to remove everything, run the suggested rm command.

All 6 comments

man brew will show you the -s flag for cleanup.

Even then, cleanup doesn't always get everything.

The cleanup section of brew鈥檚 man page (emphasis mine):

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)

This is expected behaviour. If you want to remove everything, run the suggested rm command.

Thanks for the answer. What's the use of keeping already installed formulae downloads files around?

In case something goes wrong and you have to reinstall.

Closing issue as solved (clarified).

@galad87 In future always, always, always fill out the issue template, please.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

JustinTArthur picture JustinTArthur  路  3Comments

vitahlin picture vitahlin  路  4Comments

zelsonia picture zelsonia  路  4Comments

MikeMcQuaid picture MikeMcQuaid  路  3Comments

Rotonen picture Rotonen  路  4Comments