MacOS itself does not provide a package manager

  1. HomeBrew
  2. MacPorts

MacPorts for the first time builds the entire base library and takes a long time to compile. The advantages are less system dependence, updating macOS without breaking existing packages, and the ability to use all open source packages.

HomeBrew uses existing libraries as much as possible, reducing compilation time and making installation easy. The disadvantage is that it is closely linked to the system.

Simple first, using HomeBrew.

Install HomeBrew

To install HomeBrew, run the following command

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

Control input breW-v, the following output indicates that the installation is successful.

Homebrew/ Homebrew-core (Git Revision C432e8; last commit 2019-04-12) Homebrew/homebrew-cask (git revision 22128; last commit 2019-04-13)Copy the code

HomeBrew common commands:

Brew search [package-name] ‘ ‘check package information: brew info [package-name] Install package: brew install [package-name] Update all packages: brew update Update a package: Brew upgrade [package-name] Uninstalls a package: brew uninstall [package-name] Lists all installed packages: brew list ‘

Solution The third package installation is slow

No agent to install third-party packages at the beginning, super slow download, configuration agent, rocket download speed.

For example, to install nodejs, run the following command before using the proxy:

brew install node

After using the agent, install the following command:

ALL_PROXY = socks5: / / 127.0.0.1:1086 brew install node

The reason for not using the mirror source is that real-time synchronization cannot be achieved. Installation error, toss about for a long time, can be because the bag is a little old.

HomeBrew Cask

HomeBrew Cask is a way to install and uninstall software from the command line, which is better than the App Store. Easy to install and clean to uninstall.

In simple terms, HomeBrew installs packages used by the development environment, while HomeBrew Cask installs compiled applications (.dmg/.pkg).

HomeBrew is integrated with HomeBrew Cask by default, requiring no additional installation.

Using Brew Cask means using HomeBrew Cask.

Typing brew cask on the command line will list all HomeBrew Cask commands.

HomeBrew Cask installer

The following is an example for installing QQ through HomeBrew Cask.

Search for QQ

A search for QQ using Brew Search [app-nam] will list apps that contain the QQ field.

$brew search qq ==> Casks QQ searchsearchqqbrowser qqlive qqmacMgr qqMusicCopy the code

Viewing Software Information

Brew cask info [app-name] brew cask info [app-name]

$brew cask info qq: 6.5.3 https://im.qq.com/macqq/ /usr/local/Caskroom/qq/6.5.3 (2 files, 231.2KB)
From: https://github.com/Homebrew/homebrew-cask/blob/master/Casks/qq.rb
==> Name
QQ
==> Artifacts
QQ.app (App)
Copy the code

Install QQ

Brew Cask install [app-name] if you can confirm, it is produced by Tencent

brew cask install qq

Upgrade all programs

Using the brew Cask upgrade command, you can upgrade all applications that pass HomeBrew Cask to the latest version, which is much faster than clicking update one software at a time.

Using the agent

When you install some software that is slow to download, you can use the agent.

ALL_PROXY=socks5://127.0.0.1:1086 brew cask install QQ

Additional instructions

It is best not to write export ALL_PROXY=socks5://127.0.0.1:1086 to configuration files such as.zshrc or.bash_profile.

ALL_PROXY=socks5://127.0.0.1:1086 before using the proxy.