In this article, we will see how to solve "xcrun: error: invalid active developer path (/Library/ Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun". This error would mostly occur when you are trying to run some commands after Mac OS upgrade. Last night after upgrading my macOS from Big Sur to Monterey, I tried to run few commands but it failed with the error "xcrun: error: invalid active developer path (/Library/ Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun".
This came as a surprise to me because just before the upgrade everything was running smoothly without any issues. I ran the same command again and again before the upgrade but never saw such error before. After checking my system for next minutes I understood the problem but before solving I thought to write an article about this error so that it will help you guys also in case you are also getting the same error.
Solved "xcrun: error: invalid active developer path (/Library/ Developer/CommandLineTools)"
Also Read: How to Install MS Visual Studio Code on macOS(Big Sur 11) using brew
So as I said this error "xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun"
would mostly come after Mac upgrade but it is not always necessary. Sometimes this error could occur due to some other reasons as well. If you are getting this error without doing any upgrade then chances are that you don't have Xcode.app installed in your System. In that case you need to install it using xcode-select --install
command as shown below.
cyberithub@zcbkm3n7523 ~ % xcode-select --install xcode-select: note: install requested for command line developer tools
If you are getting "error xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun"
after OS upgrade then chances are that Xcode.app
is available in /Applications
path but System is looking it into some other location. So to deal with this problem you need to switch the location by using xcode-select -s /Applications/Xcode.app
command as shown below.
cyberithub@zcbkm3n7523 ~ % sudo xcode-select -s /Applications/Xcode.app
In my case, above solution worked out as I already had Xcode.app
available in /Applications
path so just switching the location solved the issue. Well, most of the time above solution should solve the error but in case if neither works then you can try to reset xcode once using xcode-select --reset
command and see if it helps.
cyberithub@zcbkm3n7523 ~ % sudo xcode-select --reset
Hopefully above solution should be enough to solve your problem. But if you are still getting the error then let me know in the comment box. I will try my best to help you.
By selecting directory it showing me invalid developer directory. Please solve my problem
still have the problem
xcode-select --install
Tnx for this ! it worked for me
It also works for me
This also worked for me. Thank you!
You save the my device.
Thanks 🙂
This solved it. Thank you!
Thanks a ton!!
The path thingy worked as i had an update recently
`xcode-select --install` could take super long time.
There is pretty faster solution:
1. Open XCode
2. Open Preferences (⌘,)
3. Go to Locations tab
4. For “Command Line Tools” option select the current version. Even there is already set current version, reselect it.
works like charm!
It worked for me too. Thank you very much!
It worked for me too. Thanks!
xcode-select --install worked for me.
Thank you very much!
Worked for me too.
Thanks!
Lovely this command solves the issue (Mac 13.2.1). Thank you very much.
sudo xcode-select -s /Applications/Xcode.app