87

I have just upgraded from OS X 10.11 "El Capitan" to 10.12: "Sierra", and when I try to access git commands inside a terminal, I get the following error:

xcrun: error: invalid active developer path

(/Library/Developer/CommandLineTools), missing xcrun at:

/Library/Developer/CommandLineTools/usr/bin/xcrun

Please help me if anyone have solution.

2
  • 7
    Possible duplicate of Command Line Tools not working - OS X El Capitan Commented Sep 14, 2016 at 9:57
  • Just Check for software update and install all latest updates available. It will start working, without doing anything else extra. Commented Sep 22, 2016 at 5:29

5 Answers 5

130

Re-install Xcode developer tools

xcode-select --install
Sign up to request clarification or add additional context in comments.

5 Comments

Is anyone having issues with this? On mine machine the commands just fails with "Can't install the software." message.
I think this is now also available through the App Store / Software Update service.
For me, this didnt fix the issue. I got Git back by installing it from .dmg, but a bunch of other stuff is still missing. Amongst it seems to be the Clang.
I've just upgraded to High Sierra and the solution is still valid.
I had to upgrade XCode too and then restart the Terminal.
10

I fixed this issue by downloading and installing the 'Command Line Tools (macOS sierra) for Xcode 8' package from Apple Developer Downloads.

Be sure to select Command Line Tools (macOS 10.12) for Xcode 8 and not the one for 8.1 beta unless you have Xcode 8.1 beta installed.

Comments

1

I just recently upgraded to macOS High Sierra Version 10.13.3 and has existing xcode. My git command lines have the same issue. "$xcode-select --install" works perfectly for me.

Comments

0

Had same problem and with putting the git's path into profile directly it will not ask the xcode anymore (if you dont need to use xcode).

  1. download the git, https://git-scm.com/download/mac and install it.
  2. in your profile add to path, i.e. export PATH=$PATH:/usr/bin (mine git is in /usr/bin).
  3. open new terminal.

Comments

0

Alone - xcode-select --install did not work for me.

Had to do all 3 steps:

  1. Download X-code from app store (if not present in Applications folder)
  2. $xcode-select --install
    a. May need to update after install using softwareupdate in command line. $sudo softwareupdate -i "Command Line Tools (macOS High Sierra version 10.13) for Xcode-9.1"

  3. $sudo xcodebuild -license

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.