This page looks best with JavaScript enabled

Using Homebrew

 ·  β˜• 2 min read

Homebrew is the package manager for OS X, similar to yum on CentOS or apt-get on Ubuntu. From the OS X command line you can install applications with the brew and brew cask commands.

1. Install brew cask

1
brew install brew-cask-completion

2. The Difference Between brew and brew cask

The difference between brew and brew cask lies in the type of application they favor. brew leans toward developers and mainly installs command-line tools; brew cask leans toward everyday users and mainly installs GUI applications.

In terms of usage there is not much difference between the two β€” you can basically just substitute brew cask for brew. See the help for details.

3. brew Create, Read, Update, Delete

  • Install
1
brew install <AppName>
  • Uninstall
1
brew uninstall <AppName>
  • Update
1
brew upgrade <AppName>
  • Pin, do not upgrade
1
brew pin <AppName>

Use unpin to release the pin

  • Inspect
1
brew info <AppName>

4. brew Day-to-Day Maintenance

  • List installed packages
1
brew list
  • Update Homebrew
1
brew update
  • Update all packages
1
brew upgrade
  • Clean up downloaded packages
1
brew cleanup

5. Disabling the Update Before Installation

If you have not set up a proxy or switched mirrors, the update before installation can be very slow or even hang. The command below disables Homebrew’s pre-install update:

1
export HOMEBREW_NO_AUTO_UPDATE=true

6. Switching brew Mirrors

1
2
3
4
5
6
7
8
9
cd "$(brew --repo)"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git
# git remote set-url origin https://github.com/Homebrew/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
# git remote set-url origin https://github.com/Homebrew/homebrew-core

brew update

WeChat Official Account
WRITTEN BY
WeChat Official Account