Question: 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: 
Updated to High Sierra 10.13.2 

**xcode-select --install** ALONE did not work for me.

1. Download X-code from app store
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
Even if you do xcode-select --install it was not fixing that for me as it showed some network error. The problem was that it could not connect to the app store. I did the following to fix it.

1. Open keystore
2. Go to system root and select certificates.
3. Open digicert high assurance EV.
4. Expand the trust section, mark it as never trust.
5. Restart system now repeat step 1, 2, 3. and mark the trust policy as
back to use system defaults.

Your app store should work now and you should be able to run xcode-select --install