brew cleanup also cleans the cask cache. But my problem was that many casks leave their installers in
/usr/local/Caskroom, which is not considered part of the cache, and thus taking up a lot of space, while in fact the installer might not be needed after the installation.
brew cask cleanup is merged with
However, I haven't found a way to purge my Caskroom folder using
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. --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 formula or cask 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.
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?