Command Line Tools not working - OS X El Capitan, Sierra, High Sierra, Mojave

rista404 picture rista404 · Oct 1, 2015 · Viewed 240k times · Source

I just upgraded from Yosemite to El Capitan (and replicated the problem upgrading from El Capitan to Sierra), and when I try to type for example git status 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

I don't have Xcode installed, never did. Anyone have a solution?

Answer

cuadraman picture cuadraman · Oct 1, 2015

Found the fix for the problem here.

xcode-select --install

This will bring up a prompt to install the necessary command line tools.