Cannot start git after upgrading macos or xcode
15 Feb 2023 - Long Ly
After upgrading the MacOS to new version, I cannot execute git commands with an error “xcrun: error: invalid active developer path”. Here is how I resolved it.
Below error returned while executing any git command.
'''xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools),
missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Failed to find the latest git commit date: VersionCheckError: Command exited
with code 1: git -c log.showSignature=false log -n 1 --pretty=format:%ad
--date=iso
Standard out:
Standard error: xcrun: error: invalid active developer path
(/Library/Developer/CommandLineTools), missing xcrun at:
/Library/Developer/CommandLineTools/usr/bin/xcrun
This error is related to Command Line tools path is reset during upgrading. We need to execute XCode commands to set it back.
# xcode-select --install
# sudo xcode-select -s /Library/Developer/CommandLineTools
We can also use XCode UI application to set it up.
- Open XCode
- Open Preferences (
⌘
,
) - Go to Locations tab
- For “Command Line Tools” select the current version
Hope this helps and save time for you.