Fix invalid active developer path (macOS Mojave)

I was just about to do my latest SVN push to to the WordPress repo when I got the “invalid active developer path” error in my Terminal. This is why my Git and SVN wasn’t working after upgrading to mac OS Mojave.

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

I’m not sure why it happened, but don’t worry! It’s an easy fix.

We just need to reinstall the XCode command-line developer tools using the following command.

xcode-select --instal

An installation will then pop up and you should be ready to go!

You might need to reset the developer tools path in some cases (I didn’t). You can use the following commands as an example.

 xcode-select --switch /Applications/
 xcode-select --switch /Library/Developer/CommandLineTools

You may also try to reset xcode if you are running out of options.

xcode-select --reset