125

I get this error when I run brew update:

$ brew update
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: Failure while executing: git checkout -q master

How to fix this issue?

164

Run the following commands to fix the above error

sudo xcode-select --install
sudo xcode-select -switch /

I found the answer on https://github.com/Homebrew/homebrew/issues/23500

I also had to do this:

sudo chown -R $(whoami):admin /usr/local

Because of some permission issues. However, do this only if you have to.

7
  • 10
    I had to add sudo xcode-select -switch /Library/Developer/CommandLineTools/ instead of just sudo xcode-select -switch / but otherwise this worked great. No need for me to chown the files though. – TunaMaxx Oct 19 '15 at 20:51
  • Worked like a charm. Thank you so much for the quick fix.This all seems to be due to El Capitan's new security features. – Zlatty Nov 2 '15 at 16:35
  • This worked for me, but strangely, it took a couple of minutes after doing this before brew doctor stopped failing. – Keith Bennett Aug 15 '16 at 16:35
  • This advice has nearly set my desk on fire. My macbook has had the CPU pinned for 10 minutes. WTF is this doing? My fault for trusting commands without understanding them. Others be warned. I now appear to have a bunch of zombie/hydra xcodebuild processes – Peter Klipfel Oct 19 '16 at 4:51
  • 2
    And don't forget to restart terminal after any new installs.. – youngrrrr Aug 30 '18 at 8:10
51

Only the following command should resolve the issue if you are the admin on the machine.

xcode-select --install

The following article helped me solve the issue

http://tips.tutorialhorizon.com/2015/10/01/xcrun-error-invalid-active-developer-path-library-developer-commandline-tools-missing-xcrun/

1
  • This worked for Catalina 10.15.5 when I ran into the same issue, but with pyenv upgrading to 3.8.3. – TheProletariat Jul 9 '20 at 22:52
2

I got this problem after updating macOS to Mojave (maybe updating the OS can causes this).

To fix it, I simply installed Xcode from the App Store instead of doing the command line stuff.

1

@Ranjith Ramachandra answer but I was able to get everything to work by only running the install command with sudo so if you’ve got modified permissions, forcing root may be needed

sudo xcode-select --install
2
  • That might because your path was correct, but the command line tools were outdated. Nice that you got it done! But did you really need to use sudo? – anki Oct 19 '19 at 15:09
  • Needing sudo is a sign that you have a non-standard setup. It may not be wrong for you, but will confuse others and doesn’t follow the out of the box macos and brew.sh idiom. I would run brew doctor and fix any permissions issues rather than force things with sudo here. Also, what was correct when this was asked may have changed so I won’t -1 this even though it doesn’t hold for macOS Catalina. – bmike May 30 '20 at 16:29
1

I got this error after updating to Catalina 10.15 here is what I found:

The error is alerting you that you need to (re) install X-code command-line tools.

run $ xcode-select --install

after this run

$ brew outdated

then

$ brew upgrade

While Homebrew automatically uninstalls old versions of formulas every 30 days you can still run the following to get ride of any unneeded stuff.

$ brew cleanup -n

and

$ brew cleanup

To learn more about homebrew check out the documentation on https://docs.brew.sh/FAQ

2
  • Actually, that's not what the error message was saying, xcrun is no longer at that path. It was a bug/incompatibility issue with homebrew that was fixed years ago. – kumowoon1025 May 30 '20 at 14:40
  • Thanks for the clarification on that! – c.buster Jun 7 '20 at 20:31

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .