If MacBook Pro is used as a development tool, there must be a very important tool, Homebrew, but the domestic installation of Homebrew has been very slow, through the official website of the program using the install.sh script installation is generally a few Kb/s speed of Git Clone. And must keep the network environment stable, otherwise accidentally will have to reinstall.

The following method can make Homebrew installation very fast

Execute official website commands:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"
Copy the code

The following errors are common

curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation timed out
Copy the code

In this case, change the Mac DNS to 8.8.8.8

443 will not be a problem, but it will be very slow and difficult to install successfully, so you need to change the download source of Homebrew

Download the install.sh installation script

curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh >> brew_install
Copy the code

Run the install.sh script to change the Homebrew source address

The default source BREW_REPO = "https://github.com/Homebrew/brew" is modified to BREW_REPO = "https://mirrors.ustc.edu.cn/brew.git"Copy the code

Perform the installation

/bin/bash brew_install
Copy the code

During the installation process, it will stop in the position below, don’t panic, just manually stop it

= = > Tapping homebrew/core Cloning into '/ usr/local/homebrew/Library/Taps/homebrew/homebrew - core'...Copy the code

Change the source of HomebreW-core

git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1  cd $(brew --repo) git remote set-url origin https://mirrors.ustc.edu.cn/brew.git cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.gitCopy the code

update

brew update
brew doctor
Copy the code