admin avatar

使用国内Homebrew镜像加速

🕒 by admin

Homebrew在国内环境下是非常缓慢的。。。

使用国内的Homebrew镜像加速,安装软件再也不用等了。。。

安装brew

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

卸載Homebrew

1
2
curl -O https://raw.githubusercontent.com/Homebrew/install/master/uninstall.sh
bash uninstall.sh

1
2
3
4
5
6
7
8
9
# 替换brew.git:
cd "$(brew --repo)"
git remote set-url origin https://mirrors.ustc.edu.cn/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

brew update

一些国内常用的Homebrew加速镜像地址

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
# 替换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

参考文章

https://www.noonme.com/post/2017/03/homebrew-speed-up/?vpslala.com https://segmentfault.com/a/1190000018520300?vpslala.com http://www.itucd.com/archives/1228?vpslala.com

💘 相关文章

写一条评论