先删除再下载
删除
cd /usr/local/Homebrew/Library/Taps/homebrew
rm -rf homebrew-core
执行以下命令就可以下载成功了(更换为国内镜像源)
git clone git://mirrors.ustc.edu.cn/homebrew-core.git/ /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core
更改镜像
然后把 brew 和 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
如果没有安装 homebrew-cask,不用执行下面的命令
cd "$(brew --repo)"/Library/Taps/caskroom/homebrew-cask
git remote set-url origin https://mirrors.ustc.edu.cn/homebrew-cask.git
brew常用命令
更新Homebrew
brew update
安装软件包
brew install xxx
更新软件包
brew upgrade xxx
查看已安装的软件
brew list