首页 > 其他分享 >MAC OS 安装homebrew速度慢的问题

MAC OS 安装homebrew速度慢的问题

时间:2023-01-06 17:39:29浏览次数:35  
标签:core git MAC https Homebrew brew homebrew OS


解决安装homebrew国内安装慢问题

一、获取 install 文件,把官网给的脚本拿下来

curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install >> brew_install

二、更改脚本中的资源链接
这里替换成清华大学的镜像,修改如下两句:

BREW_REPO = “https://github.com/Homebrew/brew“.freeze
CORE_TAP_REPO = “https://github.com/Homebrew/homebrew-core“.freeze(有的版本不存在)

更改为这两句

BREW_REPO = "https://mirrors.ustc.edu.cn/brew.git".freeze
CORE_TAP_REPO = "https://mirrors.ustc.edu.cn/homebrew-core.git".freeze(不存在就不管)

也可以换成别家的。

tips:有些提示要替换CORE_TAP_REPO = “https://github.com/Homebrew/homebrew-core“.freeze,但是我根据1中的命令下载的脚本中,没有找到CORE_TAP_REPO选项,这里说明下系统版本:mojave 10.14.3。
三、运行脚本

/usr/bin/ruby brew_install

等待最后执行安装完成。

如果出现如下问题
Error: Failure while executing: git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
Error: Failure while executing: /usr/local/bin/brew tap homebrew/core
是因为源的问题,需要更换git的源。
————————————————

git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1

cd "$(brew --repo)"

git remote set-url origin https://mirrors.ustc.edu.cn/brew.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-core"

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-core.git

cd "$(brew --repo)/Library/Taps/homebrew/homebrew-cask"

git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git

tips:如果已经正常下载了源文件,就不需要git clone拉文件了。直接进入对于目录,重新设置相关的origin地址就可以了。这里是有的中科大的源,国内也有清华的,阿里的等源也可以使用,具体可以查询相关地址,操作一样

设置完,执行brew update 更新

 

标签:core,git,MAC,https,Homebrew,brew,homebrew,OS
From: https://blog.51cto.com/sunjikui/5994452

相关文章