使用国内镜像安装brew
使用国内镜像安装brew
原安装命令
ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
下载brew install.sh脚本
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh >> ~/Downloads/install.sh
更换源
原install.sh文件
BREW_REPO = "https://github.com/Homebrew/brew"
CORE_TAP_REPO = "https://github.com/Homebrew/homebrew-core" (新版本没有)
本地install.sh文件
BREW_REPO = "https://mirrors.ustc.edu.cn/brew.git"
CORE_TAP_REPO = "https://mirrors.ustc.edu.cn/homebrew-core.git" (新版本没有)
给本地install.sh文件添加权限
chmod 777 install.sh
执行本地install.sh文件
sh install.sh
脚本停止
Cloning into ‘/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core’…
原因:源不通
手动更换中科院的镜像
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1
然后将homebrew-core的镜像地址更改为中科院的国内镜像
`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`
执行brew 更新命令
brew update
执行brew 检查命令
brew doctor