Update the mac brew mirror source

# Replace brew.git:

$ cd "$(brew --repo)"

# China University of Science and Technology:

$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

# Tsinghua University:

$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

 

# Replace homebrew-core.git:

$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

# China University of Science and Technology:

$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

# Tsinghua University:

$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

 

# Replace homebrew-bottles:

# China University of Science and Technology:

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

$ source ~/.bash_profile

# Tsinghua University:

$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile

$ source ~/.bash_profile

 

# Application takes effect:

$ brew update

You can choose one of the above USTC and Tsinghua University.

 

Reset the default update source

# Reset brew.git:

$ cd "$(brew --repo)"

$ git remote set-url origin https://github.com/Homebrew/brew.git

 

# Reset homebrew-core.git:

$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

$ git remote set-url origin https://github.com/Homebrew/homebrew-core.git

 

After completing the replacement of the update source, we can use $ brew upgrade to update the existing software to the latest version. Finally, don't forget to $ brew cleanup to clean up old software installation packages.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326181400&siteId=291194637
Recommended