am using Homebrew to install packages on MacOS Sierra or Mac OS X. I noticed multiple version of bash or curl installed in /usr/local/Cellar/bash/. How can I delete an outdated version of brew packages and only keep the latest version on my system?
First, open the Terminal application. To see if multiple version of curl packages installed, enter:
$ ls /usr/local/Cellar/curl/
$ brew info curl
curl: stable 7.51.0 (bottled) [keg-only]
Get a file from an HTTP, HTTPS or FTP server
/usr/local/Cellar/curl/7.50.3 (367 files, 2.6M)
Built from source on 2016-11-02 at 03:13:19 with: –with-nghttp2
/usr/local/Cellar/curl/7.51.0 (368 files, 2.7M)
Built from source on 2016-11-08 at 01:10:09 with: –with-nghttp2
Build: pkg-config ?
Optional: openssl ?, libidn ?, rtmpdump ?, libssh2 ?, c-ares ?, libmetalink ?, libressl ?, nghttp2 ?
Build with C-Ares async DNS support
Build with GSSAPI/Kerberos authentication support.
Build with support for Internationalized Domain Names
Build with libmetalink support.
Build with LibreSSL instead of Secure Transport or OpenSSL
Build with scp and sftp support
Build with HTTP/2 support (requires OpenSSL or LibreSSL)
Build with OpenSSL instead of Secure Transport
Build with RTMP support
This formula is keg-only, which means it was not symlinked into /usr/local.
macOS already provides this software and installing another version in
parallel can cause all kinds of trouble.
Generally there are no consequences of this for you. If you build your
own software and it requires this formula, you ll need to add to your
Say hello to the cleanup option
The cleanup option can remove all installed or specific formulae, remove any older versions from the cellar. Also, old downloads from the Homebrew download-cache are deleted. Simply type the following command to free up disk space and delete outdated older versions:
$ brew cleanup
Fig.01: Delete outdated version of package using brew
It is recommended that you run cleanup after update to get rid of old packages:
$ brew update && brew upgrade && brew cleanup
At the end you will see the following message on screen:
Removing: /usr/local/Cellar/android-sdk/24.2… (1,460 files, 105.3M)
Removing: /usr/local/Cellar/android-sdk/24.4… (1,471 files, 136.4M)
Removing: /usr/local/Cellar/atk/2.20.0… (205 files, 3.1M)
Removing: /usr/local/Cellar/babl/0.1.16… (37 files, 819.1K)
Removing: /usr/local/Cellar/bash/4.3.42… (59 files, 7.3M)
Removing: /usr/local/Cellar/bash/4.3.46… (59 files, 7.3M)
Removing: /usr/local/Cellar/bash/4.4… (145 files, 8.8M)
Removing: /Users/veryv/Library/Logs/Homebrew/libtorrent… (1.9K)
Removing: /Users/veryv/Library/Logs/Homebrew/most… (5 files, 124.5K)
Removing: /Users/veryv/Library/Logs/Homebrew/mtr… (68B)
Removing: /Users/veryv/Library/Logs/Homebrew/nmap… (6 files, 1.6M)
Removing: /Users/veryv/Library/Logs/Homebrew/openssl… (68B)
Removing: /Users/veryv/Library/Logs/Homebrew/rsnapshot… (3 files, 10.2K)
Removing: /Users/veryv/Library/Logs/Homebrew/ssh-copy-id… (68B)
Removing: /Users/veryv/Library/Logs/Homebrew/wakeonlan… (2 files, 470B)
==> This operation has freed approximately 3.9G of disk space.
A note about cask
Type the following to cleanup cask too:
$ brew cask cleanup
==> Removing cached downloads
==> This operation has freed approximately 199.8M of disk space.