首页 > 解决方案 > 我们如何减少 homebrew-cask 和 homebrew-core 文件夹的大小?

问题描述

有没有办法减少 homebrew-cask 和 homebrew-core 文件夹的大小?它们分别为 230.7 MB 和 346.5 MB。

此外,brew cleanup没有做很多,二进制文件仍然存在于 ~/Library/Caches/Homebrew/downloads 文件夹中,这是设计使然吗?

标签: homebrewhomebrew-cask

解决方案


是的,这是设计使然。

man 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. If you want to remove everything, use --prune=all.

   -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.

因此,您可以运行brew cleanup -s以从缓存中删除更多内容或rm -rf $(brew --cache)删除整个缓存。

另请参阅https://github.com/Homebrew/brew/issues/3784

这是预期的行为。如果要删除所有内容,请运行建议的 rm 命令。

感谢你的回答。保留已安装的公式下载文件有什么用?

万一出现问题,您必须重新安装。


推荐阅读