Homebrew代理国内加速

Mac搭配homebrew简直舒爽啊,然而homebrew托管在github,对国内用户来说不仅频频被墙,而且速度也不理想。今天笔者就告诉大家国内用户顺畅访问homebrew的方法。

中科大的镜像

中科大镜像比较稳定,而且速度不错。官方网站:http://mirrors.ustc.edu.cn

搜索brew,然后点击Help即可查看用法:

替换Homebrew默认源

Python
# 替换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 替换<span class="wp_keywordlink_affiliate"><a href="https://www.168seo.cn/tag/homebrew" title="View all posts in Homebrew" target="_blank">Homebrew</a></span> Bottles源 对于bash用户: echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' &gt;&gt; ~/.bash_profile source ~/.bash_profile 对于zsh用户: echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' &gt;&gt; ~/.zshrc source ~/.zshrc 清华大学镜像 也是比较靠谱的开源镜像。官方网站:https://mirror.tuna.tsinghua.edu.cn/help/homebrew/。 替换<span class="wp_keywordlink_affiliate"><a href="https://www.168seo.cn/tag/homebrew" title="View all posts in Homebrew" target="_blank">Homebrew</a></span>默认源 # 替换brew.git: cd "$(brew --repo)" 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.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git brew update 使用homebrew-science或者homebrew-<span class="wp_keywordlink"><a href="http://www.168seo.cn/python" title="python">python</a></span> cd "$(brew --repo)/Library/Taps/homebrew/homebrew-science" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-science.git cd "$(brew --repo)/Library/Taps/homebrew/homebrew-<span class="wp_keywordlink"><a href="http://www.168seo.cn/python" title="python">python</a></span>" git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-<span class="wp_keywordlink"><a href="http://www.168seo.cn/python" title="python">python</a></span>.git brew update 替换<span class="wp_keywordlink_affiliate"><a href="https://www.168seo.cn/tag/homebrew" title="View all posts in Homebrew" target="_blank">Homebrew</a></span> Bottles源 对于bash用户: echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' &gt;&gt; ~/.bash_profile source ~/.bash_profile 对于zsh用户: echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' &gt;&gt; ~/.zshrc source ~/.zshrc 其它镜像 搬http://ban.ninja/ 此为Homebrew Bottles源,及下载二进制文件地址: bash用户: echo 'export HOMEBREW_BOTTLE_DOMAIN=http://7xkcej.dl1.z0.glb.clouddn.com' &gt;&gt; ~/.bash_profile source ~/.bash_profile 对于zsh用户: echo 'export HOMEBREW_BOTTLE_DOMAIN=http://7xkcej.dl1.z0.glb.clouddn.com' &gt;&gt; ~/.zshrc source ~/.zshrc coding homebrew 只有Homebrew源,没有二进制文件源。 cd "$(brew --repo)" git remote set-url origin https://git.coding.net/homebrew/homebrew.git brew update 重置Homebrew默认源 # 重置brew.git: cd "$(brew --repo)" git remote set-url origin https://github.com/Homebrew/brew.git # 重置homebrew-core.git: cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core" git remote set-url origin https://github.com/Homebrew/homebrew-core.git brew update 其它加速方法 除了通过替换源加速之外,如果你有自己的代理,也可以通过代理加速。 如socks代理配置: vi ~/.curlrc # 改成自己的代理端口 <span class="wp_keywordlink_affiliate"><a href="https://www.168seo.cn/tag/socks5" title="View all posts in socks5" target="_blank">socks5</a></span>=127.0.0.1:1080 或者通过proxychains: brew install <span class="wp_keywordlink_affiliate"><a href="https://www.168seo.cn/tag/proxychains-ng" title="View all posts in proxychains-ng" target="_blank">proxychains-ng</a></span> 然后在/usr/local/etc/proxychains.conf配置代理信息,即在 [ProxyList] 下面(也就是末尾)加入代理类型,代理地址和端口,如: <span class="wp_keywordlink_affiliate"><a href="https://www.168seo.cn/tag/socks5" title="View all posts in socks5" target="_blank">socks5</a></span> 127.0.0.1 1080 配置好之后就可以在需要使用代理的命令前加proxychians来加速: proxychians brew update proxychians brew install ...
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# 替换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 Bottles源
 
对于 bash用户:
 
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' & gt ; & gt ; ~ / . bash_profile
source ~ / . bash _profile
对于 zsh用户:
 
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.ustc.edu.cn/homebrew-bottles' & gt ; & gt ; ~ / . zshrc
source ~ / . zshrc
清华大学镜像
也是比较靠谱的开源镜像。官方网站: https : / / mirror . tuna . tsinghua . edu . cn / help / homebrew /。
 
替换 Homebrew默认源
 
# 替换brew.git:
cd "$(brew --repo)"
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 . tuna . tsinghua . edu . cn / git / homebrew / homebrew - core . git
 
brew update
使用 homebrew - science或者 homebrew - python
 
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-science"
git remote set - url origin https : / / mirrors . tuna . tsinghua . edu . cn / git / homebrew / homebrew - science . git
 
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-python"
git remote set - url origin https : / / mirrors . tuna . tsinghua . edu . cn / git / homebrew / homebrew - python . git
 
brew update
替换 Homebrew Bottles源
 
对于 bash用户:
 
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' & gt ; & gt ; ~ / . bash_profile
source ~ / . bash _profile
对于 zsh用户:
 
echo 'export HOMEBREW_BOTTLE_DOMAIN=https://mirrors.tuna.tsinghua.edu.cn/homebrew-bottles' & gt ; & gt ; ~ / . zshrc
source ~ / . zshrc
其它镜像
搬 http : / / ban . ninja /
此为 Homebrew Bottles源,及下载二进制文件地址:
 
bash用户:
 
echo 'export HOMEBREW_BOTTLE_DOMAIN=http://7xkcej.dl1.z0.glb.clouddn.com' & gt ; & gt ; ~ / . bash_profile
source ~ / . bash _profile
对于 zsh用户:
 
echo 'export HOMEBREW_BOTTLE_DOMAIN=http://7xkcej.dl1.z0.glb.clouddn.com' & gt ; & gt ; ~ / . zshrc
source ~ / . zshrc
coding homebrew
只有 Homebrew源,没有二进制文件源。
 
cd "$(brew --repo)"
git remote set - url origin https : / / git . coding . net / homebrew / homebrew . git
 
brew update
重置 Homebrew默认源
# 重置brew.git:
cd "$(brew --repo)"
git remote set - url origin https : / / github . com / Homebrew / brew . git
 
# 重置homebrew-core.git:
cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"
git remote set - url origin https : / / github . com / Homebrew / homebrew - core . git
 
brew update
其它加速方法
除了通过替换源加速之外,如果你有自己的代理,也可以通过代理加速。
 
如 socks代理配置:
 
vi ~ / . curlrc
 
# 改成自己的代理端口
socks5 = 127.0.0.1 : 1080
或者通过 proxychains:
 
brew install proxychains - ng
然后在 / usr / local / etc / proxychains . conf配置代理信息,即在 [ ProxyList ] 下面(也就是末尾)加入代理类型,代理地址和端口,如:
 
socks5 127.0.0.1 1080
配置好之后就可以在需要使用代理的命令前加 proxychians来加速:
 
proxychians brew update
proxychians brew install . . .
 
 



  • zeropython 微信公众号 5868037 QQ号 5868037@qq.com QQ邮箱
  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值