2015-09-19 271 views
0

我一直试图在我的mac上安装Git,但每次使用$ git --version命令。无法在我的mac上安装Git

我收到以下错误

xcrun:错误:活跃的开发路径(“/Volumes/Xcode/Xcode.app/Contents/Developer”)不存在,使用xcode-select --switch path/to/Xcode.app指定您希望的Xcode用于命令行开发人员工具(或参见man xcode-select

我已经在我的Mac上为iOS应用程序开发安装了Xcode。 我不知道这个错误是想说什么。

+0

是否安装了XCode的命令行工具(https://developer.apple.com/downloads/)?请描述你如何安装Git。我已经转向HomeBrew作为一名软件包管理员,并对此感到非常满意。如果你想尝试一下,我在这里有一些说明:http://steve-tarver-mac.blogspot.com/2015/05/install-homebrew.html。 –

+0

所以你做了什么消息说,并运行'xcode-select --switch path/to/Xcode.app'?如果是这样,发生了什么?你应该在你的问题中描述。 – sideshowbarker

+0

@sideshowbarker我试过了,但是它说 sudo:xcode-select:command not found – Jasmeet

回答

1

所以从上述评论的讨论,似乎这里的解决方法是只运行该命令/usr/bin/xcode-select -switch一旦与/Applications/Xcode.app/Contents/Developer/(即具有完整路径可执行文件运行它,而艾德里安就像xpath)作为参数:

sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer 

运行一次后,一切都应该按照预期工作。

0

您可以通过brew软件包管理器为Mac安装git。我建议以这种方式安装软件,因为这是在一个地方管理已安装软件包的好方法。例如,您可以执行brew update以获取最新软件包更新的列表,或登录brew upgrade以升级通过brew安装的所有软件。

  1. 要安装酿造,打开一个终端窗口,执行:

    ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)" 
    
  2. 更新您的BREW封装,brew update

  3. 安装混帐与brew install git
0

我已经安装的git ,然后返回到安装前打开的终端窗口。我尝试运行命令git --version,并在下面引发此错误消息。为了解决,我在相同的终端窗口中运行命令source /etc/profile。顺便说一句,终端窗口是在我的Webstorm里面,我的最终目标是git init并为我的新reactjs项目设置git。快乐的编码!

错误:

xcrun: error: active developer path ("/Volumes/Xcode/Xcode.app/Contents/Developer") does not exist, use \`xcode-select --switch path/to/Xcode.app\` to specify the Xcode that you wish to use for command line developer tools (or see \`man xcode-select\`)