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

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
要在Mac上使用Brew进行国内加速,你可以按照以下步骤进行操作: 1. 打开终端。 2. 输入以下命令,将Homebrew的核心库切换到中国科技大学的镜像: ``` cd "$(brew --repo)/Library/Taps/" mkdir homebrew && cd homebrew git clone git://mirrors.ustc.edu.cn/homebrew-core.git ``` [1] 3. 接下来,输入以下命令,将Homebrew的Cask库切换到中国科技大学的镜像: ``` cd "$(brew --repo)/Library/Taps/" cd homebrew git clone https://mirrors.ustc.edu.cn/homebrew-cask.git ``` [2] 4. 如果你还需要使用brew-cask,可以运行以下命令(这两个命令是可选的): ``` sudo mkdir -p /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask sudo git clone https://mirrors.ustc.edu.cn/homebrew-cask.git /usr/local/Homebrew/Library/Taps/homebrew/homebrew-cask ``` [3] 这样,你就成功将Homebrew切换到了中国科技大学的镜像,可以更快地进行软件包的安装和更新了。<span class="em">1</span><span class="em">2</span><span class="em">3</span> #### 引用[.reference_title] - *1* *2* [国内mac安装brew](https://blog.csdn.net/xihuanyuye/article/details/122589595)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] - *3* [Mac无法安装brew神器国内解决方案](https://blog.csdn.net/meimeieee/article/details/105796182)[target="_blank" data-report-click={"spm":"1018.2226.3001.9630","extra":{"utm_source":"vip_chatgpt_common_search_pc_result","utm_medium":"distribute.pc_search_result.none-task-cask-2~all~insert_cask~default-1-null.142^v92^chatsearchT0_1"}}] [.reference_item style="max-width: 50%"] [ .reference_list ]
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值