Perintah yang Anda inginkan adalah cleanup
- menjalankan brew cleanup
akan menghapus paket yang ada di disk, tetapi tidak lagi diinstal.
> brew help cleanup
brew cleanup [--prune=days] [--dry-run] [-s] [formulae]:
For all installed or specific formulae, remove any older versions from the
cellar. In addition, old downloads from the Homebrew download-cache are deleted.
If --prune=days is specified, remove all cache files older than days.
If --dry-run or -n is passed, show what would be removed, but do not
actually remove anything.
If -s is passed, scrubs the cache, removing downloads for even the latest
versions of formulae. Note downloads for any installed formulae will still not be
deleted. If you want to delete those too: rm -rf $(brew --cache)
Sebagai contoh:
> brew cleanup
Removing: /usr/local/Cellar/awscli/1.10.19... (2,955 files, 22.3M)
Removing: /usr/local/Cellar/git/2.8.2... (1,418 files, 30.5M)
Removing: /usr/local/Cellar/imagemagick/6.9.3-7... (1,459 files, 17.9M)
Removing: /usr/local/Cellar/libgcrypt/1.7.0... (17 files, 1.5M)
Removing: /usr/local/Cellar/libgpg-error/1.21... (19 files, 419.4K)
Removing: /usr/local/Cellar/libksba/1.3.3... (13 files, 343K)
Removing: /usr/local/Cellar/mercurial/3.7.3... (386 files, 4.7M)
Removing: /usr/local/Cellar/node/6.0.0... (3,655 files, 38.8M)
Removing: /usr/local/Cellar/openssl/1.0.2g... (1,678 files, 12.0M)
Removing: /usr/local/Cellar/vim/7.4.1795... (1,687 files, 22.6M)
Removing: /Library/Caches/Homebrew/git-2.8.2.el_capitan.bottle.tar.gz... (11.2M)
Removing: /Library/Caches/Homebrew/imagemagick-6.9.3-7.el_capitan.bottle.tar.gz... (7M)
Removing: /Library/Caches/Homebrew/libgcrypt-1.7.0.el_capitan.bottle.tar.gz... (565.4K)
Removing: /Library/Caches/Homebrew/libgpg-error-1.21.el_capitan.bottle.tar.gz... (130.8K)
Removing: /Library/Caches/Homebrew/libksba-1.3.3.el_capitan.bottle.tar.gz... (126.6K)
Removing: /Library/Caches/Homebrew/node-6.0.0.el_capitan.bottle.tar.gz... (10.9M)
Removing: /Library/Caches/Homebrew/openssl-1.0.2g.el_capitan.bottle.tar.gz... (3.6M)
Removing: /Library/Caches/Homebrew/vim-7.4.1795.tar.gz... (12.0M)
==> This operation has freed approximately 196.4M of disk space.
Saya memiliki rejimen Senin pagi:
brew update
brew upgrade
brew cleanup
Itu memberi saya informasi terkini tentang Homebrew, lalu semua brews yang saya instal dan kemudian membebaskan ruang disk dengan menghapus brews lama yang tidak lagi dirujuk. Untuk brews yang perlu saya pertahankan pada versi tertentu, saya gunakan brew pin
untuk menahan mereka di sana sehingga saya masih dapat menjalankan ini sederhana, tiga perintah, rantai untuk memperbarui segala sesuatu yang lain di sekitar paket yang disematkan.
brew clean
.