从下面的路径下载安装命令,保存到本地:
https://raw.githubusercontent.com/Homebrew/install/master/install.sh
将文件中的以下内容做对应修改
HOMEBREW_BREW_GIT_REMOTE="https://github.com/Homebrew/brew"
改为清华大学镜像源,如下:
HOMEBREW_BREW_GIT_REMOTE="https://github.com/Homebrew/brew"
HOMEBREW_CORE_GIT_REMOTE="https://github.com/Homebrew/homebrew-core"
改为清华的国内源,如下:
HOMEBREW_CORE_GIT_REMOTE="https://mirrors.ustc.edu.cn/homebrew-core.git"
保存文件,为文件增加执行权限,并安装
chmod +x ./install.sh
./install
执行以下命令,检查是否成功安装
brew -v
若在安装时出现以下内容,则表示没有正确安装 homebrew-core
Error:
homebrew-core is a shallow clone.
To `brew update`, first run:
git -C /usr/local/Homebrew/Library/Taps/homebrew/