1. 程式人生 > >ma BREW更換源,讓brew install 更快

ma BREW更換源,讓brew install 更快

網上很多都是說替換清華大學的源或中科大的,但好像不太管用:

# 替換brew.git:
$ cd "$(brew --repo)"
# 中國科大:
$ git remote set-url origin https://mirrors.ustc.edu.cn/brew.git
# 清華大學:
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

# 替換homebrew-core.git:
$ cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
# 中國科大:
$ git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git
# 清華大學:
$ git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git

# 替換homebrew-bottles:
# 中國科大:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile
# 清華大學:
$ echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' >> ~/.bash_profile
$ source ~/.bash_profile

# 應用生效:
$ brew update

但清華的好像不太管用,我用如下方案可以:


1. 替換 homebrew-core源
cd “$(brew –repo)/Library/Taps/homebrew/homebrew-core”//注意,把引號換成小寫的
git remote set-url origin git://mirrors.ustc.edu.cn/homebrew-core.git
2. 替換 Homebrew Bottles源
export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles

//如果想永久生效,把上面一條放到~/.bash_profile裡