Mac 10.13.3安装HomeBrew与CocoaPods时LibreSSL SSL错误解决咨询
解决Mac 10.13.3安装Homebrew/CocoaPods时的LibreSSL SSL_ERROR_SYSCALL错误
我之前帮不少开发者处理过这个问题,大概率是网络连接限制或者系统SSL配置的兼容性问题,试试下面这几个实用方法,应该能搞定:
方法一:切换网络环境
- 如果你当前用的是公司/学校内网,大概率是防火墙拦截了GitHub的连接,换成手机热点或者其他公共网络试试
- 切换网络后,重新执行Homebrew安装命令:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
方法二:临时重置Git的SSL验证
有时候Git的SSL配置抽风,先临时关闭验证试试:
- 执行命令关闭全局SSL验证:
git config --global http.sslVerify false - 重新尝试安装Homebrew,成功后记得再把验证打开(安全起见):
git config --global http.sslVerify true
方法三:替换Homebrew为国内镜像源(适配10.13.3版本)
Mac 10.13.3自带的LibreSSL版本对GitHub连接支持不佳,换成国内镜像能绕开这个问题:
- 先把安装脚本下载到本地:
curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install > brew_install.sh - 打开脚本文件:
open brew_install.sh,把里面的https://github.com/Homebrew/brew替换成https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.git - 执行修改后的脚本:
/usr/bin/ruby brew_install.sh - 安装完成后,设置后续的镜像源避免再出问题:
git -C "$(brew --repo)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/brew.gitgit -C "$(brew --repo homebrew/core)" remote set-url origin https://mirrors.tuna.tsinghua.edu.cn/git/homebrew/homebrew-core.git
方法四:检查防火墙与代理
- 如果开了Little Snitch这类第三方防火墙,先临时关闭再试安装
- 要是用了代理工具,确认代理配置正确,或者临时关闭代理直接连接网络
等Homebrew安装成功后,CocoaPods的问题基本也能跟着解决。如果装CocoaPods时还遇到SSL问题,同样可以用Git SSL重置或者换国内源的方法:pod repo remove master && pod repo add master https://mirrors.tuna.tsinghua.edu.cn/git/CocoaPods/Specs.git
内容的提问来源于stack exchange,提问作者Jack




