After upgrading to macOS Mojave, I tried to run GIT from Terminal but it kept giving me the following error:
xcrun: error: invalid active developer path (
Open Terminal, and run the following:
xcode-select --install
This will download and install xcode developer tools and fix the problem. The problem is that one needs to explicitly agree to the license agreement. As a follow on step, you may need to reset the path to Xcode if you have several versions or want the command line tools to run without Xcode.
xcode-select --switch /Applications/Xcode.app
xcode-select --switch /Library/Developer/CommandLineTools
I have also found the solution in this question.
https://apple.stackexchange.com/questions/254380/macos-mojave-invalid-active-developer-path