After upgrading to macOS High Sierra on my MacBook Pro yesterday, I noticed that GitHub command line tools stopped working and an error came up when I tried to clone a GitHub repository. Here is the error that was presented to me:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
If you are facing the same issue, then the fix is simple. Follow these steps in order to fix this issue:
1. Download Command Line Tools
First of all, visit the download page of Command Line Tools and download Command Line Tools for Xcode. As of now, the latest version, that worked for me as well, is 9.2. Once the DMG file is downloaded, run the installer.
2. Reset Xcode Command Line Tools
Once the installation completes, launch your terminal and run this command:
sudo xcode-select --reset
That’s it. Now the issue should have been fixed. Please remember that these instructions address the issues resulted due to the upgrade. If Command Line Tools weren’t installed ever, then you will have to install all the tools by running this command:
I hope this fixes the issue for you as well like it did for me.