I have just updated my OS X to El Capitan.

In previous version I have git installed with Xcode (as it was recommended settings).

After updating I could not use git. git command shows.

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

git --version also shows same error. I have installed XQuartz but the problem didn't resolve.

I will mostly use git from terminal or from Jetbrains IDE

  • What version of Xcode have you got? I would reinstall the latest Xcode.
    – mmmmmm
    Mar 21, 2016 at 10:43

2 Answers 2


One solution might be install git again.

But to ensure it works like before you may install Xcode by running

xcode-select --install
  • Welcome to Ask Different! This does not provide an answer to the question. To critique or clarification from an author, leave a comment below their post - you can always comment on your own posts, and once you have sufficient reputation you will be able to comment on any post.
    – Tetsujin
    Mar 21, 2016 at 8:50
  • Do remember to close the terminal after you run this command. Sep 29, 2018 at 17:59
  • 1
    Had to restart all dependent software to follow up (in my case, Android Studio)
    – em_
    Nov 7, 2018 at 23:53

My reputation is too low to comment; otherwise I would have commented on Nafeez Abrar's answer. His answer is correct. Two points:

  • This post on github gist provides the same guidance Nafeez did, along with comments indicating that running "xcode-select --install" worked for them.
  • I just tried running that command myself and it worked for me. Before running that command (which installed/updated Xcode or added the Xcode command-line tools - I didn't pay close attention, but it ran an Xcode installer and I think said the command-line tools needed to be installed), I got the same error; afterward, git worked again. (Part of the issue in my case is that I've got two gits installed and the one that appears to be part of the Xcode installation was first in my path.)

Anyway, it seems like @Tetsujin's comment is incorrect, so it seems like the cleanest way to update this thread would be to update or remove his incorrect comment, (maybe) modify Nafeez's answer to include the github.com reference, and (maybe) make my answer a comment instead (as Nafeez deserves credit for a correct answer).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .