← 返回命令列表

Linux command

brew-cleanup 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Remove outdated downloads and old versions

brew cleanup

Preview what would be removed

brew cleanup --dry-run

Clean specific formula

brew cleanup [formula]

Remove cache files older than specified days

brew cleanup --prune=[30]

Scrub cache including latest versions

brew cleanup -s

Delete entire cache

rm -rf "$(brew --cache)"

说明

brew cleanup removes old versions of installed formulae and casks, deletes cached downloads, and frees disk space. It cleans the Cellar and the download cache. Homebrew automatically performs cleanup after upgrades and periodically every 30 days unless HOMEBREW_NO_INSTALL_CLEANUP is set.

参数

--dry-run, -n
Show what would be removed without removing
--prune _days_
Remove cache files older than specified days
-s
Scrub cache, including downloads for latest versions
--prune-prefix
Remove empty directories from Homebrew prefix
--formula
Treat all arguments as formulae
--cask
Treat all arguments as casks

FAQ

What is the brew-cleanup command used for?

brew cleanup removes old versions of installed formulae and casks, deletes cached downloads, and frees disk space. It cleans the Cellar and the download cache. Homebrew automatically performs cleanup after upgrades and periodically every 30 days unless HOMEBREW_NO_INSTALL_CLEANUP is set.

How do I run a basic brew-cleanup example?

Run `brew cleanup` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --dry-run, -n do in brew-cleanup?

Show what would be removed without removing