Fix git After High Sierra Upgrade

By  on  

Every major operating system upgrade is a grand adventure.  No matter the vendor or how vanilla you keep your system:  stuff is going to break.  This was very much the case with git when I upgraded my MacBook Pro to High Sierra.

After the upgrade I tried to pull down a git branch and received the following cryptic error:

xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun

Every OS upgrade is interesting in its own ways but you can bet your life that something relating to Xcode will go wrong.  I tried using Homebrew to install git by itself (brew install git) but that didn't ensure git worked properly so I went with a fix that's worked in the past:

xcode-select --install

The command above restored git and I was able to instantly get back to work.  The mystery of how Xcode and its developer tools getting ruined with every install is really something Apple should address.  In any event, keep this blog post handy each time you upgrade your Mac operating system!

Recent Features

  • By
    Write Simple, Elegant and Maintainable Media Queries with Sass

    I spent a few months experimenting with different approaches for writing simple, elegant and maintainable media queries with Sass. Each solution had something that I really liked, but I couldn't find one that covered everything I needed to do, so I ventured into creating my...

  • By
    I’m an Impostor

    This is the hardest thing I've ever had to write, much less admit to myself.  I've written resignation letters from jobs I've loved, I've ended relationships, I've failed at a host of tasks, and let myself down in my life.  All of those feelings were very...

Incredible Demos

  • By
    PHP / MooTools 1.2 Accordion Helper

    The MooTools Accordion plugin seems to be the plugin that people seem to have the most problems with. It's an awesome plugin, so I can see why so many people want to use it, but I think that may be part of the problem.

  • By
    MooTools, Mario, and Portal

    I'm a big fan of video games. I don't get much time to play them but I'll put down the MacBook Pro long enough to get a few games in. One of my favorites is Portal. For those who don't know, what's...

Discussion

  1. Thanks for the heads up!

    Not only does this happen with every OS update, but I also had to recover my customized Apache configuration – using the builtin Apache on macOS – every time after a major update. Fortunately the old config files are backed up upon starting the update.

  2. This is not something that’s ever happened to me in all the OS upgrades I’ve done. Git has always continued to work just fine. However, I’ve saved a link to this post just in case – there’s always a first time!

  3. Jørn

    Thanks! Upgraded yesterday evening. This morning at work I find out git stopped working. Found your post and the fix worked like a charm.

  4. It doesn’t happened to me till i have upgraded the operating system with Sierra. I have bookmarked this page, if i will face any issue with the update.

    Thank you,

  5. Holt Johnson

    Thanks, you saved me time! I just updated MacOS over the weekend. I read your post this morning so I tried to pull a branch to see if I had the same issue, and I did. Your solution put a quick stop to the issue, thanks for giving me an instant solution!

  6. FYI, this didn’t work for me after installing the 10.13.1 update and finding Xcode command line tools broken like this.

    I got

    xcrun: error: invalid active developer path (/Applications/Xcode.app/Contents/Developer), missing xcrun at: /Applications/Xcode.app/Contents/Developer/usr/bin/xcrun"
    

    errors for brew commands, gcc commands, etc.

    It seems these days, every time Apple update something, they’re breaking something, too :/

    FWIW, my issue was that somehow the path was now wrong. It worked yesterday, so don’t look at me. But the fix, for me, was:

    sudo xcode-select -s /Library/Developer/CommandLineTools

    to set the correct path.

Wrap your code in <pre class="{language}"></pre> tags, link to a GitHub gist, JSFiddle fiddle, or CodePen pen to embed!