Blog Cover

Hot to fix 'xcrun: error: invalid active developer path, missing xcrun' on macOS

Author profile image
Aitor Alonso

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:

xcode-select --install

You will be prompted to install the command line tools.

XCode Command Line Tools installation prompt

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 git again.

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 --install again. Also, try running xcode-select --reset to 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 .dmg directly 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!