MAC切换brew源为其他国内源

在brew install yara时发现中科大的源中缺少包,于是换个源试试,当然,也可以手动下载一下。(最后附了可手动下载的其他源地址及下载方法)

1、看需要修改哪些地方
# brew update -verbose
//返回
Checking if we need to fetch /usr/local/Homebrew...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask...
Fetching /usr/local/Homebrew...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask...
Checking if we need to fetch /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services...
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core...
Fetching /usr/local/Homebrew/Library/Taps/homebrew/homebrew-services...

在这里插入图片描述
更新时需要检查这4个文件夹
我们需要替换其中的3个:
/usr/local/Homebrew
/usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
 

2、替换(我替换为清华源)
# cd "$(brew --repo)"
# git remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.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

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

 

3、升级
# brew update

在这里插入图片描述
搞定~ 换源成功~
在这里插入图片描述
 

4、手动下载
中科大源
https://mirrors.ustc.edu.cn/brew.git

清华源
https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git

阿里源
https://mirrors.aliyun.com/homebrew/brew.git

腾讯源
https://mirrors.cloud.tencent.com/homebrew/brew.git

缺少某版本包时,可到上面的源中手动下载到本地
然后移动到brew --cache文件夹内
最后brew install 安装即可
在这里插入图片描述

 

参考文章:
https://blog.miuyun.work/archives/19233913
https://www.jianshu.com/p/bea984d27cd2
https://www.cnblogs.com/bfyang5130/p/12983831.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值