您的位置:首页 > 其它

MacOS上安装Git的两种方法:homebrew 和 Xcode

2018-11-07 09:49 232 查看

有两种安装Git的方法:

1. 先安装homebrew(点击),再通过它安装Git。

(1)在Mac终端(Terminal)中输入命令:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

按回车等待它自己安装就可以了,安装时间会较长,请耐心等待。

(2)检查是否安装成功,在Terminal中输入命令:

brew


如果出现这样的页面,证明homebrew安装成功。

(3)安装Git,在Terminal中输入命令:

brew install git

接着就是再次耐心地⌛️等待了🍺🍺

2. 通过Xcode安装Git

(1)安装Xcode从App Store安装Xcode(Apple官方IDE,功能非常强大)。Xcode集成了Git,不过没有默认安装,需要手动安装Command Line Tools。

(2)安装Command Line Tools:在Mac终端(Terminal)中输入命令:

xcode-select --install

根据提示进行安装。

(3)检查是否安装成功,重新在Terminal中输入

xcode-select --install

此时它会提醒你:

xcode-select: error: command line tools are already installed, use "Software Update" to install updates


证明安装成功。PS:具体操作也可参考Micky米写的Xcode中Command Line Tools安装方法

阅读更多
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: