在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...

image-1691499116657

更新时需要检查这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

image-1691499139655

搞定~ 换源成功~
image-1691499150131
 

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 安装即可

image-1691499163566

 

参考文章:
https://www.jianshu.com/p/bea984d27cd2
https://www.cnblogs.com/bfyang5130/p/12983831.html