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: 
I had the same issue after upgrading to macOS Catalina.
This didn't work for me:

```
xcode-select --install

```

Downloading and installing [Command Line Tools for Xcode 12](https://download.developer.apple.com/Developer_Tools/Command_Line_Tools_for_Xcode_12/Command_Line_Tools_for_Xcode_12.dmg) did it!

[![enter image description here](https://i.stack.imgur.com/eliYM.png)](https://i.stack.imgur.com/eliYM.png)
After update to macOS 10.13.3

After updating do macOS 10.13, I had to install 
**"Command Line Tools (macOS 10.13) for Xcode 9.3"**
downloaded from <https://developer.apple.com/download/more/>