Hot to fix 'xcrun: error: invalid active developer path, missing xcrun' on macOS
Mar 26, 2023
1 min read
When using a brand-new Mac computer, or sometimes after upgrading macOS to a new version, it is possible that when you try to use
git, the terminal returns an obscure error like this:
$ git status xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
What it really happens, is that you are missing the Apple Developer Tools, which are required to use
git and other command line tools like some compilers. They can be wiped after some updates, so you'll need to reinstall them.
How to fix it
So te solution is pretty simple, you just need to install the Apple Developer Tools, and they come bundled with XCode.
However, XCode is a pretty big package, and you'll only need it if you are developing iOS apps, so we'll install only the command line tools, which are much smaller.
To do that, open a terminal and run the following command:
You will be prompted to install the command line tools.
Allow the installation (it may ask for your password and require you to accept the XCode license) and let it download the required packages. It should take only a few minutes, depending on your internet connection speed. After that, you should be able to use
Still not working?
If the above didn't work for you, here are some steps that may help:
- Try rebooting your computer (seriously, sometimes this can fix it).
- Try running
xcode-select --installagain. Also, try running
xcode-select --resetto reset the xcode config to default values.
- If none of the above worked, try to install the full XCode IDE. You can get it from the App Store. Also, you can get the
.dmgdirectly from the Apple Developer website.
I hope my article has helped you, or at least, that you have enjoyed reading it. I do this for fun and I don't need money to keep the blog running. However, if you'd like to show your gratitude, you can pay for my next coffee(s) with a one-time donation of just $1.00. Thank you!