我很乐意清理我的设备上的任何自制更新或版本副本,然后我认为用于这一点的命令应该是
brew cleanup如果我想检查它将清除多少存储空间,命令应该是
brew cleanup -n
brew cleanup --dry-run它们似乎都不适合我,我想清除我的电脑上任何多余的无用的自制软件副本。
另外,有没有可能它实际上正在发生,但它没有向我显示任何输出?
下面是输出:
temp@Apples-MacBook-Pro ~ % brew cleanup -n
temp@Apples-MacBook-Pro ~ % brew cleanup
temp@Apples-MacBook-Pro ~ % 我所需要的只是一些输出,显示当我运行该命令时可以清除/清除多少空间。
有没有可能,因为我昨天才安装了home-brew,所以没有要删除的东西,所以输出是这样的?
发布于 2020-12-30 15:30:58
这可能是因为没有什么需要清理的(特别是如果你只喝了一天的Homebrew )。
我不确定你所说的“我想清除我的电脑中任何多余的无用的自制软件”是什么意思。因为这不是brew cleanup的作用。用于删除brew install期间自制软件下载的旧文件和未使用的文件。它不是用来清除Homebrew的旧版本的(当你使用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.请注意“删除超过120天的所有下载”部分。如果你还没有在Homebrew中安装那么多东西,或者你已经很长时间没有使用它了,那么应该没有什么需要清理的。此外,即使使用-s选项,Homebrew也不会删除“任何已安装的配方或桶”的文件。
尝试安装和卸载一些东西,然后执行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.请注意,在安装这些公式时执行brew cleanup,它不会显示任何输出。只有当它们被卸载时,它才会变成需要清理的东西。
或者尝试传入--prune=1选项(删除超过1天的所有缓存文件)和-s选项(清除缓存,即使是最新版本)。在我使用Homebrew多年的系统上:
~$ brew cleanup --prune=1 -s -n
...
==> This operation would free approximately 1.1GB of disk space.https://stackoverflow.com/questions/65502748
复制相似问题