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
    From Webcam to Animated GIF: the Secret Behind chat.meatspac.es!

    My team mate Edna Piranha is not only an awesome hacker; she's also a fantastic philosopher! Communication and online interactions is a subject that has kept her mind busy for a long time, and it has also resulted in a bunch of interesting experimental projects...

  • By
    Welcome to My New Office

    My first professional web development was at a small print shop where I sat in a windowless cubical all day. I suffered that boxed in environment for almost five years before I was able to find a remote job where I worked from home. The first...

Incredible Demos

  • By
    Disable Autocomplete, Autocapitalize, and Autocorrect

    Mobile and desktop browser vendors do their best to help us not look like idiots by providing us autocomplete, autocorrect, and autocapitalize features.  Unfortunately these features can sometimes get in the way;  we don't always want or need the help they provide.  Luckily most browsers allow...

  • By
    Fullscreen API

    As we move toward more true web applications, our JavaScript APIs are doing their best to keep up.  One very simple but useful new JavaScript API is the Fullscreen API.  The Fullscreen API provides a programmatic way to request fullscreen display from the user, and exit...

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.

    • This worked for me! Saved my life, thank you.

    • Rick Jamison

      Thanks Daniel.. this worked for me.

  7. Arsalan

    So simple, yet so great! Thank you so much.

    Arsalan

  8. John O

    Hi – just wanted to say thank you for posting this. I updated MacOS today from El Capitan to High Sierra. I did some code updates, tried to push them and got an error. I reinstalled the dev tools using your Terminal command, and hey presto, git is working again. :-)

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