When using git for the first time in OSX Mavericks you may run into a problem where you get the following error:
xcrun: error: invalid active developer path (/usr/bin), missing xcrun at: /usr/bin/usr/bin/xcrun
This error indicates can be fixed by running the following commands:
sudo xcode-select --install
This will force the Xcode command line tools to be reinstalled. Now we just run the following command to point xcrun to the correct path for the reinstalled tools:
sudo xcode-select -switch /
Credit to people in this homebrew issue thread for identifying this fix:
Edit: I have received feedback that this also works for 10.10 Yosemite and 10.11 El Capitan.