Confusion over cleaning up the Caskroom with `brew cleanup`

(Xiang Ji) #1

Now brew cask cleanup is merged with brew cleanup.

However, I haven’t found a way to purge my Caskroom folder using brew cleanup.

The man page says:

   cleanup [options] [formula|cask]
       Remove stale lock files and outdated downloads for formulae and casks, and remove old versions of installed formulae. If arguments are specified, only do
       this for the specified formulae and casks.

              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 formula or cask will still not be deleted. If
              you want to delete those too: rm -rf "$(brew --cache)"

              Only prune the symlinks and directories from the prefix and remove no other files.

I want to delete the installers for the currently installed packages as well.

For example, the mactex installer takes up almost 4 GB of space.

Apparently, the command for non-cask installs is rm -rf "$(brew --cache), but what is the equivalent for casks?

(Mike McQuaid) #2

brew cleanup also cleans up the Cask cache.

(Xiang Ji) #3

I see. I think my issue was that the MacTex installer pkg file is not considered cache, and is still taking up a lot of space in the /usr/local/Caskroom folder. However it is actually not needed after the installation, and thus it might be better to consider it as cache. And I see something similar with several other installers as well.

(Mike McQuaid) #4

The handling of /usr/local/Caskroom is indeed not considered cache. You’re best to submit an issue to Homebrew/homebrew-cask about this.