Update: This also happened to me after updating to OSX 10.11 El Capitan. I downloaded this file from Apple to install command line tools manually, and this fixed the problem once more.
Yesterday I upgraded to OSX Yosemite and as usual one of the first things that I did was run
git on the command line to install OSX Command Line Developer Tools:
After clicking the Install button and accepting the agreement, I received the following message:
I knew that the message wasn’t accurate because I tried on multiple networks and different days, all the time while the rest of my networking and internet access was working fine.
After searching the web for “can’t download the software because of a network problem” I found nothing useful, but then I found that you can download and install a package from Apple’s developer web site.
You need to be a registered Apple developer to get it, and I am, so that fixed it up for me.
Note, you’ll also see this error if you try to do anything else that requires command line tools, like running
~ brew update
'xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun