命令行工具不起作用-OS X El Capitan,Sierra,High Sierra,Mojave

本文翻译自:Command Line Tools not working - OS X El Capitan, Sierra, High Sierra, Mojave

I just upgraded from Yosemite to El Capitan (and replicated the problem upgrading from El Capitan to Sierra), and when I try to type for example git status inside a terminal, I get the following error: 我刚刚从优胜美地升级到El Capitan(并复制了从El Capitan升级到Sierra的问题),当我尝试在终端机中键入git status ,出现以下错误:

xcrun: error: invalid active developer path
 (/Library/Developer/CommandLineTools), missing xcrun at:
 /Library/Developer/CommandLineTools/usr/bin/xcrun

I don't have Xcode installed, never did. 我没有安装Xcode,也从未安装过。 Anyone have a solution? 有人有解决办法吗?


#1楼

参考:https://stackoom.com/question/2E14u/命令行工具不起作用-OS-X-El-Capitan-Sierra-High-Sierra-Mojave


#2楼

Found the fix for the problem here . 这里找到解决问题的方法。

xcode-select --install

This will bring up a prompt to install the necessary command line tools. 这将提示您安装必要的命令行工具。


#3楼

If you have issues with the xcode-select --install command; 如果您对xcode-select --install命令有xcode-select --install eg I kept getting a network problem timeout, then try downloading the dmg at developer.apple.com/downloads (Command line tools OS X 10.11) for Xcode 7.1 例如,我一直遇到网络问题超时,然后尝试在developer.apple.com/downloads (命令行工具OS X 10.11)上为Xcode 7.1下载dmg。


#4楼

我尝试了xcode-select --install解决方案,但对我没有帮助,我从Sierra更新到High,然后发生了这种情况,我的解决方案是:

sudo xcode-select --reset

#5楼

I just updated to High Sierra and I couldn't just run xcode-select --install . 我只是更新到High Sierra,而不能只运行xcode-select --install First, I had to actually install xcode from the app store. 首先,我必须从应用商店实际安装xcode。 Then I ran xcode-select --install . 然后我运行xcode-select --install Then I had to run sudo xcodebuild -license , agree to the terms, then I could finally run git commands again. 然后我必须运行sudo xcodebuild -license ,同意条款,然后我终于可以再次运行git命令。


#6楼

Reassigning the path Xcode is configured with worked for me. 重新分配路径Xcode已为我工作。

sudo xcode-select -switch /Applications/Xcode.app

You'll then likely be prompted (after trying a command) to agree to the license agreement. 然后,可能会提示您(尝试执行命令后)同意许可协议。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

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

余额充值