Installing Homebrew

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Update brew:

brew update

Packages

Install Packages

Examples:

brew install wget
brew cask install iterm2

Install from Git: https://github.com/Homebrew/homebrew-core/tree/master/Formula:

brew install https://github.com/Homebrew/homebrew-core/blob/master/Formula/docker.rb

Upgrade Packages

Upgrade all packages:

brew upgrade

Uninstall Packages

brew uninstall wget
brew cask uninstall iterm2

Refusing to uninstall package because it is required by some packages which are currently installed. Override this and force removal with:

brew uninstall --ignore-dependencies gcc

Remove all versions:

brew uninstall --force gcc

Remove a list of packages:

brew uninstall $(brew list PACKAGE_NAMES)

Packages Info

brew info gcc
brew cask info atom

Browse Packages

http://formulae.brew.sh/

brew search
brew cask search

List Installed Packages

brew list
brew cask list

Default Installation Path

/usr/local/Cellar
/usr/local/Caskroom

Bash Path

For some packages, users should configure the local bash profile to add the path of installed packages.

export PATH="/usr/local/anaconda3/bin:$PATH"

Recovery

Remove packages

Remove all installed homebrew packages:

brew remove --force $(brew list) --ignore-dependencies  

Uninstall

Uninstall homebrew by the following command:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/uninstall)"

Reference

Official

  1. Homebrew Official Website
  2. Homebrew Documentation
  3. Homebrew Documentation - Tips and Tricks

Blogs and Posts

  1. Remove all installed Homebrew packages

Videos

  1. Install Homebrew - the missing package manager for OS X