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: 
For Mojave

Uninstall Any old version of Command Line Tools:

```
sudo rm -rf /Library/Developer/CommandLineTools

```

Download and [Install Command Line Tools 10.14 Mojave](https://developer.apple.com/download/more/).
For those also having issues with `heroku` command line tools after upgrading, I also had to do the following in my terminal:

```
xcode-select --install 
brew install heroku/brew/heroku
brew link --overwrite heroku

```

It seems the upgrade to High Sierra messed with my symlinks in addition to forcing me to reinstall xcode tools. I kept getting 'not a directory' errors: 

```
▸ stat /Users/mattymc/.local/share/heroku/client/bin/heroku: not a directory  
▸ fork/exec /Users/mattmcinnis/.local/share/heroku/client/bin/heroku: not a directory 

```

Hope that saves someone an hour :)