官网的方法不再赘述
按照官网的方法我没安装上,以下是我自己在网上找的方法,分享出来。
首先下载brew_install文件,
(这个可以在网上找到)
修改其中的一行代码:
#BREW_REPO = "https://github.com/Homebrew/brew".freeze
BREW_REPO = "git://mirrors.ustc.edu.cn/brew.git".freeze
然后打开终端执行:
/usr/bin/ruby 这里跟上你刚才修改好的brew_install 文件路径
然后空格、输入密码、等待执行完成
运气好的话,执行成功
我这不行,失败,摆报错是下面的信息
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
fatal: unable to access 'https://github.com/Homebrew/homebrew-core/': LibreSSL SSL_read: SSL_ERROR_SYSCALL, errno 54
Error: Failure while executing; `git clone https://github.com/Homebrew/homebrew-core /usr/local/Homebrew/Library/Taps/homebrew/homebrew-core --depth=1` exited with 128.
Error: Failure while executing; `/usr/local/bin/brew tap homebrew/core` exited with 1.
这里我是直接粘贴别的网站上的错误,我自己的错误找不到了。报错一样。
然后按照顺序在终端执行以下代码:
// 执行下面这句命令,更换为中科院的镜像:
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 update
最后检测
brew --version
出现版本好即表示安装成功。
下面是我参考的解决方法的原帖子:
https://www.jianshu.com/p/9118ee9da3b7