command-line git macos terminal xcode

Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)


I updated to macOS Mojave (this happens on Catalina update too, and seems to potentially occur on every major update thereafter)

This morning I navigated to my work’s codebase in the Command Line on my MacBook pro, typed in “git status” in the repository and received the error:

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

How do I fix git, and command line tools?


  • 7

    Possible duplicate…

    – markroxor

    Jul 1, 2019 at 5:28

  • 124

    to be honest, this problem is something APPLE should take care of. They create it, they should fix it !!!!! Asking everyone to run that command everytime this happens isn’t an Good/Correct option. Not to mention you need to download that big chunk for git only.

    Feb 4, 2021 at 14:30

  • 5

    I didn’t run into it on my update to Big Sur. Only had this problem the year when I originally wrote this Q&A. I’ve just been updating it every year to include the latest changes.

    Feb 5, 2021 at 5:07

  • 8

    We should get paid by apple for debugging their code!

    – Nir

    Apr 1, 2021 at 9:46

  • 16

    I updated to Monterey and faced the same issue. Apple really needs to look into this issue.

    Nov 2, 2021 at 23:37


The problem is that Xcode Command-line Tools needs to be updated.

Solution #1

Go back to your terminal and enter:

xcode-select --install

You’ll then receive the following output:

xcode-select: note: install requested for command line developer tools

You will then be prompted in a window to update Xcode Command Line tools. (which may take a while)

Open a new terminal window and your development tools should be returned.

Addition: With any major or semi-major update you’ll need to update the command line tools in order to get them functioning properly again. Check Xcode with any update. This goes beyond Mojave…

After that restart your terminal

Alternatively, IF that fails, and it very well might…. you’ll get a pop-up box saying “Software not found on server”, see below!

Solution #2

and you hit xcode-select --install and it doesn’t find the software, log into Apple Developer, and install it via webpage.

Log in or sign up here:

Look for: “Command Line Tools for Xcode 12.x” in the list of downloads
Then click the dmg and download.

image of apple developer page and dmg for DL


  • 72

    This fixed the issue I had with Microsoft Visual Studio Code which was complaining about Git not being installed when I first launched it after upgrading to Mojave. I thought the issue was VS Code, but it was the issue in this SO question. Restarting VS Code after installing the Xcode Command-line Tools solved the issue.

    – Mark

    Oct 10, 2018 at 0:36

  • 349

    I wish the Xcode update was part of the OS update. Something like this happens every time I upgrade. Annoying.

    – mvndaai

    Dec 14, 2018 at 17:17

  • 20

    Definitely annoying though. A simple check for Xcode installation and then an update during the OS update would be pretty simple to add. It’s always something with these OS updates from Apple. You’d think they’d have figured it out by now.

    – zgr024

    Dec 14, 2018 at 20:53

  • 19

    For anyone using Git in PHPStorm; you need to restart PHPStorm after running xcode-select --install. Then it’ll work.

    Feb 13, 2019 at 7:20

  • 71

    This solution works for me for Mac Catalina update also. Superb!!!

    Oct 8, 2019 at 16:55


I got some errors that the software was unavailable from the update server when trying

xcode-select --install

What fixed it for me was going here and downloading Command Line Tools (macOS 10.14) for Xcode 10 and then installing it manually.

After that, the errors should be gone when you open up a new terminal.


  • 13

    This should be the right answer, tried on 3 machines and @dustbuster answer doesn’t work anymore and it shows “software was unavailable from the update server when trying”

    Nov 2, 2018 at 14:17

  • 7

    For me this ends with software not available at server but @High6’s answer below works. xcode-select --reset

    – briankip

    Nov 4, 2018 at 14:59

  • downloading Command Line Tools (macOS 10.14) for Xcode 10.1 from the link. thanks!

    Nov 4, 2018 at 21:33

  • 2

    Had xcode installed still there were issues. This worked like a charm… should be the selected answer. Or should be addendum to top answer.

    – AmitM

    Nov 22, 2019 at 11:43

  • 2

    This also works for macOS 10.15.2. Though I had to select Command Line Tools for Xcode 11.3, since Xcode 10.1 wasn’t available

    Dec 13, 2019 at 21:04


For me xcode-select --reset was the solution on Mojave.


  • 6

    somehow, “xcode-select –install” ends of software not available at server. But this one works

    – Yan Zhu

    Nov 1, 2018 at 4:32

  • This worked for me, I ran this command after installed new Xcode.

    Sep 24, 2019 at 2:01

  • 5

    I just upgraded from Mac OS X 10.14 (Mojave) to MacOS 10.15 (Catalina) and faced this problem, this solution worked fine, it was no necessary to run xcode-select --install.

    – OJVM

    Oct 22, 2019 at 22:19

  • 2

    works for me on Catalina as well, but needed to add sudo

    – gafi

    Nov 6, 2019 at 10:58

  • 4

    sudo xcode-select --reset worked for me on a Mojave –> Catalina upgrade of MacOS

    Dec 12, 2019 at 15:34