mac安装git系列报错解决

1. 下载git 首先想到的就是去 git 下载官网

Git - Downloading Package

  在命令行执行:  brew install git

接着就出现报错:  

2. command not found: brew

原因:电脑没有安装brew

解决:

/bin/zsh -c "$(curl -fsSL https://gitee.com/cunkai/HomebrewCN/raw/master/Homebrew.sh)"

按提示操作后出现一下弹窗

其中出现俩个报错: 

xcode-select: note: no developer tools were found at '/Applications/Xcode.app', requesting install. Choose an option in the dialog to download the command line developer tools.

xcode-select: note: install requested for command line developer tools

即使 你点安装继续往后操作也无法成功安装。

解决方案:

xcode-select --install	// 安装命令
sudo xcode-select --reset	//恢复默认设置
sudo rm -rf /Library/Developer/CommandLineTools	//删除commandlinetools
xcode-select --version	// 查看版本

如果以上命令无法解决问题,需在苹果官网 Sign In - Apple 手动下载 与目前Mac系统相同或者相近版本的  Command Line Tools  并安装;

  如果选择的工具版本比系统版本新,则会出现一下情况,无法安装。

 待工具完成安装以后,然后重新执行第2步,进行安装brew,如下图即安装完成。

 随即重启终端,进行git操作测试

 

3. 查看安装的brew版本(可省)

brew --version

  

4. 扩展方法

        Mac 安装 git 可以通过 xocde进行配置,也即无需安装Command line tools(也不单独安装git、gcc、cpp等),而是直接安装了Xcode成功后,发现可以成功调用git、gcc、cpp等命令!

注意:安装Xcode的版本需要与系统版本香匹配!

       比如系统版本10.15.7比Xcode版本低,会出现一下报错。

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

小白目

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值