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?


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.

  • 8
    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
  • 1
    And don't forget to restart terminal after any new installs.. – youngrrrr Aug 30 '18 at 8:10

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



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.

You must log in to answer this question.

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