MacOS speed up installation Homebrew, Homebrew installation is very slow to solve problems

installation

1. The official program website (https://brew.sh/) given is this:

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

According to this method is slow

2. Get the official website of the install file (https://raw.githubusercontent.com/Homebrew/install/master/install) Save as brew_install

3. Change the source inside the

BREW_REPO = “https://github.com/Homebrew/brew“.freeze
CORE_TAP_REPO = “https://github.com/Homebrew/homebrew-core“.freeze

change to

 

BREW_REPO = "https://mirrors.ustc.edu.cn/brew.git".freeze
CORE_TAP_REPO = "https://mirrors.ustc.edu.cn/homebrew-core.git".freeze

Homebrew second row where the new version may not exist, only need to change the first line.

4. Execute the script, using the ruby ​​execution

 

/usr/bin/ruby brew_install

If the terminal stays in:

 

==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...

Description Source nowhere, commutation Source:

 

git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

Then homebrew-core is also set to address a mirror image of domestic Chinese Academy of Sciences

 

cd "$(brew --repo)"
 
sudo git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
 
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
 
sudo git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

Update brew (or not updated)

 

brew update

Use this command to check and correct:

 

check the version brew --version #
brew doctor

Change the default source

Direct use homebrew need to change the default source for the Tsinghua source USTC

Replace core depot

 

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
sudo git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

Replace cask depot (provided macOS applications and large binary files)

 

cd "$(brew --repo)"/Library/Taps/caskroom/homebrew-cask
sudo git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

Replace bottles source (Homebrew pre-compiled binary packages

 

sudo echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
source ~/.bash_profile

6. brew commonly used commands

转载自:https://juejin.im/post/5c738bacf265da2deb6aaf97 

发布了62 篇原创文章 · 获赞 9 · 访问量 7830

Guess you like

Origin blog.csdn.net/qq_40491305/article/details/103827544