可以将文章内容翻译成中文,广告屏蔽插件可能会导致该功能失效(如失效,请关闭广告屏蔽插件后再试):
问题:
Last night i updated to macOS Mojave,
This morning I navigated to my work's code base in Command line on my MacBook pro,
typed in "git status" in the repo and received the error:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
回答1:
The problem is that Xcode Command-line Tools needs to be updated.
Go back to your terminal and hit:
xcode-select --install
You'll then receive:
xcode-select: note: install requested for command line developer tools
And be prompted in a window to update Xcode Command Line tools.
After the update is completed, open a new terminal window and your development tools should be returned.
回答2:
I got some errors that the software was unavailable from the update server when trying
xcode-select --install
What fixed it for me was going here https://developer.apple.com/download/more/ and downloading Command Line Tools (macOS 10.14) for Xcode 10
and then installing it manually.
After that, the errors should be gone when you open up a new terminal.
回答3:
For me xcode-select --reset
was the solution on Mojave.
回答4:
In addition to dustbuster's answer I needed to set path to the Xcode folder with this command:
sudo xcode-select -switch /Library/Developer/CommandLineTools
回答5:
For me what worked is
sudo xcode-select --reset
as is on @High6's answer above, then
sudo sudo xcodebuild -license
this will reveal a licence which I assume is some xcode licence, scroll to the bottom using space
button then type agree
.
This is what worked for me on MacOS Mojave v 10.14
回答6:
I figured out the Xcode Command Line Tools part from the error message, but after running Xcode and getting the prompt to install the additional tools it did claim to install them, but still I got the same error after opening a new terminal.
So I did the xcode-select --install
manually and after that it worked for me.
回答7:
For me, I didn't have xcode installed (on Mojave OS). I went to the App Store on my mac and downloaded it, then went back to terminal and typed git
and hit enter, then it worked.
回答8:
if you dont have xcode or setup manually without xcode.
- sudo rm -rf /Library/Developer/CommandLineTools
- https://developer.apple.com/download/more/ and downloading Command Line Tools (macOS 10.14) for Xcode 10 and then installing it manually.
- Setup Command Line Tools
Take it be easy
else
- xcode-select --install . enough this.