我很想清除我的任何自制软件更新或版本副本的设备,然后我认为用于该的命令将是
brew cleanup
Run Code Online (Sandbox Code Playgroud)
如果我想检查它会清除多少存储空间,命令将是
brew cleanup -n
brew cleanup --dry-run
Run Code Online (Sandbox Code Playgroud)
它们似乎都不适合我,我想清除我的计算机上任何多余的 Homebrew 无用副本。
另外,它是否有可能实际上正在发生,但它没有向我显示任何输出?
这是输出:
temp@Apples-MacBook-Pro ~ % brew cleanup -n
temp@Apples-MacBook-Pro ~ % brew cleanup
temp@Apples-MacBook-Pro ~ %
Run Code Online (Sandbox Code Playgroud)
我所需要的只是一些输出,显示当我运行命令时可以清除/清除多少空间。
有没有可能因为我昨天安装了 home-brew,所以没有什么可以删除的,因此这个输出?
这可能是因为没有什么可以清理的(特别是如果你只使用了 1 天的 Homebrew)。
我不知道你说的“我想清除我的电脑上任何多余的无用的自制软件副本”是什么意思,因为那不是brew cleanup目的。它用于删除 Homebrew 在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.
Run Code Online (Sandbox Code Playgroud)
请注意“删除超过 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.
Run Code Online (Sandbox Code Playgroud)
注意做 brew cleanup安装这些公式时,它不会显示任何输出。只有当它们被卸载时,它才会成为需要清理的东西。
或者尝试传入--prune=1选项(删除所有早于 1 天的缓存文件)和选项(清理-s缓存,即使是最新版本)。在我使用 Homebrew 多年的系统上:
~$ brew cleanup --prune=1 -s -n
...
==> This operation would free approximately 1.1GB of disk space.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
6442 次 |
| 最近记录: |