之前 git 是用 xcode 工具包安装好的,大概是升级系统的原因,git 又不能用了。所以需要重新安装:

xcode-selet --install

附 xcode-select command not found 解决方法

xcode-select 属于 xcode 工具包的脚本,如果提示 xcode-select 指令不存在,那就是 macOS 没有安装 xcode。

可以考虑安装 xcode,当然也可以直接通过 homebrew 指令安装(git 官网推荐):

brew install git

然后问题套娃了:brew 指令不存在Homebrew 官网的安装脚本:

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"

但这个脚本总是提示 ssl connect failed,无法访问该安装脚本。

继续搬砖,找到 homebrew 的镜像地址安装:

# 安装 homebrew ,在终端输入
sh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

按照脚本选择可使用的镜像,选择 Y 进行安装,问题解决。

文章目录