Git is not working after macOS Update (xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools)
Solution 1
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:
https://developer.apple.com/download/more/
Look for: "Command Line Tools for Xcode 12.x" in the list of downloads Then click the dmg and download.
Solution 2
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 https://developer.apple.com/download/more/ 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.
Solution 3
For me xcode-select --reset
was the solution on Mojave.
Solution 4
In addition to dustbuster's answer I needed to set path to the Xcode folder with this command:
sudo xcode-select -switch /Library/Developer/CommandLineTools
Solution 5
updated from Mojave to Big Sur and got the same error : the command
xcode-select --install
worked like a charm
dustbuster
I enjoy hunting bugs, making code more efficient, trouble shooting difficult problems, and long walks on the beach. I've been in php frameworks the past few years, including Magento and Laravel. But I've also worked in VBScript and Cold Fusion over the last decade as well. I'm also writing frontend Vue these days as well. I am also a father of 3, a husband, my other interests are the fitness (mountain biking, weight training) gaming, some Djing here and there, and just spending time with the fam-fam. I get stoked on life!! There's a lot of very smart people here on the Stack, and I am happy to be a part of such a large community trying to make developers lives easier.
Updated on July 10, 2022Comments
-
dustbuster almost 2 years
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?
-
dustbuster over 5 yearsThis is more of a git problem than a macOS problem.
-
markroxor almost 5 yearsPossible duplicate apple.stackexchange.com/questions/254380/…
-
windmaomao over 3 yearsto 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.
-
dustbuster over 3 yearsI 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.
-
alianjum0 over 3 yearsIf you don't have Xcode, only installing Xcode command line tools will solve the problem. developer.apple.com/download/more/?=command%20line%20tools
-
Roy Smith about 3 yearsalianjum0, thanks for that. I just went down a huge rat hole being unable to install XCode from the AppStore (long story). Being able to install just the CLI saved the day!
-
Nir about 3 yearsWe should get paid by apple for debugging their code!
-
dustbuster about 3 yearsIt's a failure to completely update ALL their software during a major version update. I have not run into this since i initially made the question and answer! So it works on some level i suppose!
-
Pryftan over 2 years@dustbuster No. It's not a problem with git. It's a macOS problem. You get the same error from other commands like make. The solution is what I thought it was but I checked here anyway as I wanted to be sure - too much going on to worry about possible fixes.
-
Vaulstein over 2 yearsAnother OS update and yet 3 years later, issue still exist.
-
thisisshantzz over 2 yearsI updated to Monterey and faced the same issue. Apple really needs to look into this issue.
-
iamnicoj over 2 yearsI never had this issue before and I've been using macOS since about the last 3 years. However I just updated it to Monterrey and it broke git.
-
Derek Greer over 2 years"This is more of a git problem ..." how so? git is merely a command line tool. I've used git on other platforms for decades and have never encountered this issue until working on a Mac. What the hell does git have to do with XCode?
-
dustbuster over 2 yearsI wrote that 3 years ago matey! lol But yea. it's totally a macOs problem. I did not think this would be a relevant for 3 years!
-
rkechols over 2 yearsIs there some issue/ticket in an Apple help system that we can upvote to try to get more attention on this?
-
Kamlesh over 2 yearsNo need to download Xcode. I am using MacOS Monterey version 12.x. I have downloaded "Command Line Tools for Xcode 13.3 beta". Restarted terminal and command line is working along with github clone/pull/push issues. It worked like charm.
-
-
Mark over 5 yearsThis 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.
-
James over 5 yearsYep same for me, @dustbuster might be a good idea to merge these answers.
-
Yan Zhu over 5 yearssomehow, "xcode-select --install" ends of software not available at server. But this one works
-
user2577923 over 5 yearsThis 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"
-
briankip over 5 yearsFor me this ends with
software not available at server
but @High6's answer below works.xcode-select --reset
-
Xavier Ojeda Aguilar over 5 yearsdownloading
Command Line Tools (macOS 10.14) for Xcode 10.1
from the link. thanks! -
mpiktas over 5 yearsOk this one solved this for me. Tried
xcode-select --install
and downloading and installing manually, none of the solutions worked. Note that I waited and upgraded to version 10.14.1. -
mvndaai over 5 yearsI wish the Xcode update was part of the OS update. Something like this happens every time I upgrade. Annoying.
-
dustbuster over 5 yearsIt's happened to me on every update. I guess the majority of Mac users don't have Xcode installed! Otherwise apple probably would update it at the same time. .
-
zgr024 over 5 yearsDefinitely 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.
-
Miguel Garrido over 5 yearsIn case you installed GIT and this is still not working you might need to add an alias:
sudo xcode-select -s /Library/Developer/CommandLineTools
-
Jim Van Zandt over 5 yearsI'd already visited the App Store, and it claimed to find no updates. Why can't it recognize that Xcode needs to be updated?
-
Daan van den Bergh about 5 yearsFor anyone using Git in PHPStorm; you need to restart PHPStorm after running
xcode-select --install
. Then it'll work. -
yantaq almost 5 yearsSame SVN issue got fixed by this method as well.
-
James almost 5 yearsWhen I go to install (after agreeing to T's & C's) I get "Can't install the software because it is not currently available from th Software Update server." Has anyone else gotten this?
-
SuryaVal almost 5 yearsI did not need to restart my terminal btw.
-
ashishn almost 5 yearsNothing is working for me. I am using Sourcetree on same repository. it shows the username and email correctly.
-
mythicalcoder almost 5 yearsI want to install Command Line Tools only and Not Xcode. This solution seems to be the best. Minimal install
-
Murwa over 4 yearsThis fixes a couple items, but not all
-
Forcetti over 4 yearsFor me running
open /Library/Developer/CommandLineTools/Packages/macOS_SDK_headers_for_macOS_10.14.pkg
after thexcode-select --install
command worked, following this stackoverflow answer -
Sunho Hong over 4 yearsThis worked for me, I ran this command after installed new Xcode.
-
Shahnaz Khan over 4 yearsThis solution works for me for Mac Catalina update also. Superb!!!
-
dustbuster over 4 yearsI updated the text to just say "MacOs update" I am very happy it works for Catalina! Figured it would!
-
OJVM over 4 yearsI 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
. -
gafi over 4 yearsworks for me on Catalina as well, but needed to add
sudo
-
luis19mx over 4 yearsjust wanted to add that you need to restart the computer, also a good
brew doctor
may also help find any issues -
Chandana Kithalagama over 4 yearsI had Xcode 10.3, 11.1 and 11.2 and Xcode wasn't able to figure out which version to use for the Command Line Tools and left the dropdown with empty. Once 11.1 was selected for my purpose, git commands started to work.
-
AmitM over 4 yearsHad xcode installed still there were issues. This worked like a charm... should be the selected answer. Or should be addendum to top answer.
-
Hiren Dabhi over 4 yearsI am using android studio on Mac, recently updated OS to Catalina. After updating OS, stop connecting to Version Control (subversion). But thanks to @dustbuster, installing xCode solve the my problem.
-
Chris Gillatt over 4 years
sudo xcode-select --reset
worked for me on a Mojave --> Catalina upgrade of MacOS -
Rachel Lanman over 4 yearsThis 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 -
Ugur Kazdal over 4 yearsBut why ? Why do we need to do this ? my question is to Apple falks
-
Tilak Madichetti over 4 yearsShould I do the same with zsh too ?
-
dustbuster over 4 yearsYou will not have to do anything to zsh Tilak. The issue is git. Not zsh.
-
Taher Khalil over 4 yearsAfter the update , you need to make sure to restart all the applications and IDE that depend or have connection with git like all IntelliJ IDEs ,sublime with git , source tree etc to make it run properly,
-
Daniel over 4 yearsyour solution worked for me on MacOS 10.13 High Sierra. Thank you.
-
Ryan Amaral over 4 yearsPerfect for me since I don't need Xcode but I do need Git :)
-
uliwitness about 4 yearsIf you have Xcode installed, you do not need the separate command line tools install. Just make sure you run
xcode-select --switch /Applications/Xcode.app/Contents/Developer
orxcode-select --reset
so Terminal will use the command line tools inside Xcode instead of the ones installed by the "command line tools" standalone installer. From then on, the App Store will auto-update Xcode and your tools will stay current. -
uliwitness about 4 yearsIf you have Xcode installed, you do not need the separate command line tools install. Just make sure you run
xcode-select --switch /Applications/Xcode.app/Contents/Developer
orxcode-select --reset
so Terminal will use the command line tools inside Xcode instead of the ones installed by the "command line tools" standalone installer. From then on, the App Store will auto-update Xcode and your tools will stay current. -
uliwitness about 4 yearsIf you have Xcode installed, you do not need the separate command line tools install. Just make sure you run
xcode-select --switch /Applications/Xcode.app/Contents/Developer
orxcode-select --reset
so Terminal will use the command line tools inside Xcode instead of the ones installed by the "command line tools" standalone installer. From then on, the App Store will auto-update Xcode and your tools will stay current. -
uliwitness about 4 yearsIf you have Xcode installed, you do not need the separate command line tools install. Just make sure you run
xcode-select --switch /Applications/Xcode.app/Contents/Developer
orxcode-select --reset
so Terminal will use the command line tools inside Xcode instead of the ones installed by the "command line tools" standalone installer. From then on, the App Store will auto-update Xcode and your tools will stay current. -
uliwitness about 4 yearsIf you have Xcode installed, this is the correct solution. Terminal will use the command line tools inside Xcode instead of the ones installed by the "command line tools" standalone installer. From then on, the App Store will auto-update Xcode and your tools will stay current.
-
uliwitness about 4 yearsThis popup is equivalent to calling
xcode-select --switch
with the path to the Xcode package of whatever version you select here, by the way. -
uliwitness about 4 yearsIf you have Xcode installed, you do not need the separate command line tools install. Just make sure you run
xcode-select --switch /Applications/Xcode.app/Contents/Developer
orxcode-select --reset
so Terminal will use the command line tools inside Xcode instead of the ones installed by the "command line tools" standalone installer. From then on, the App Store will auto-update Xcode and your tools will stay current. -
uliwitness about 4 yearsAlso, it makes no sense to do both calls to
xcode-select --switch
above. The second one overwrites what the first one did. Do the first one and your command line tools will update as part of Xcode. -
uliwitness about 4 yearsIf you have Xcode installed, you do not need the separate command line tools install. Just make sure you run
xcode-select --switch /Applications/Xcode.app/Contents/Developer
orxcode-select --reset
so Terminal will use the command line tools inside Xcode instead of the ones installed by the "command line tools" standalone installer. From then on, the App Store will auto-update Xcode and your tools will stay current. -
taha about 4 yearsGood hint thank you , Whatever the way , the important thing is to solve the issue
-
iGW about 4 yearsThis works for me.. Thanks a lot. I was having old and new version of Xcode at different locations.
-
Vikram K almost 4 years2020 Update: Same solution for Catalina OS
-
Anupam almost 4 yearsJuly 2020 Update: This did not work on Mac OS Mojave (after upgrading from El Captain). This worked from the accepted answer:
xcode-select --install
. Takes a while to install though -
Anupam almost 4 yearsJuly 2020 Update: This answer worked for me on Mac OS Mojave (after upgrading from El Captain). Takes a while to install though. (Just doing
xcode-select --reset
as mentioned in other answers did not work for me) -
gurehbgui almost 4 yearsXcode select did it since I only had the beta version installed!
-
mobcity zkore over 3 yearsbeen through so many answers, this is the one that worked for me after the Mojave update, thanks!
-
jkix over 3 yearsOn Mac OS 10.15.6 Catalina, this was the solution that worked for me. (Command Line tools for Xcode 12 if you're on Catalina - skip the mammoth Xcode 12 app download)
-
vincentmajor over 3 yearsAfter I installed Catalina and trying the
xcode-select --install
answer I had an error from the UI installer: "xcode-select: note: install requested for command line developer tools". This was the only thing that worked for me since I didn't want to install Xcode. (I used the Command Line Tools for XCode 12.) -
BKE over 3 yearsDoes not work for Catalina.
sudo xcode-select --reset
appears to do nothing. -
James Render over 3 yearsI needed to run this command after I migrated from old Mojave MBP to new Catalina MBP and couldn't have git etc running; intellij complained
-
Vishrant over 3 yearsYou saved my day!! Awesome. Maven started working after this.
-
dustbuster over 3 years@Vishrant I am just happy I could contribute to the interwebs! You are quite welcome!
-
dustbuster over 3 yearsThe way apple manages the xcode downloads has changed. I actually ran into this myself AGAIN when i upgraded this year! So i updated the answer not too long ago.
-
Md. Abu Nafee Ibna Zahid over 3 yearsFor PyCharm also need to do like PHPStorm as suggested by @DaanvandenBergh . That is need to restart PyCharm after running
xcode-select --install
-
larrydalmeida over 3 yearsUpgraded to macOS Big Sur and here it is again.
-
dustbuster over 3 yearsI have updated this answer every year! Check out solution #2, that's probably the most relevant. There's a surge this time every year!
-
geekhunger over 3 yearsI had to download
Command_Line_Tools_for_Xcode_12.3_beta.dmg
for MacOS 11.1 Big Sur. Then it worked perfectly. -
dustbuster over 3 yearsGlad to hear! I have not updated yet. is that the name of the download file now?
-
Ling Vu over 3 yearsBest answer for Big Sur
-
Manish over 3 yearsFor big Sur, this first priority is usefull. Thanks for saving lot of time and Data.
-
Ali Qaderi over 3 yearsI am using Big Sur (xcode-select --install) helped me.
-
Emile Beukes over 3 yearsthanks a lot! I immediately went for solution 2 once I read that solution 1 might very well fail haha.
-
dustbuster over 3 yearsMost Excellent! I actually didn't run into it this time around when I updated to Big Sur.
-
windmaomao over 3 yearsHow could Git is not part of OSX? If not, then make it never part of OSX? what's the benefits of bundling a developer tool in the operation system which is not responsible for updating it?
-
Romain TAILLANDIER about 3 yearsWork for me on catalina
-
Anand about 3 yearsAwesome! Solution #1 works for me. Thanks :) It's so annoying to do this after every minor update. Techies at Apple Listen O Listen !!
-
dustbuster about 3 yearsYou should not have to do it after every update, that is annoying!!
-
MMK about 3 yearsbest answer! This issue doesn’t require installation of the tool again
-
ChuckZHB about 3 yearsI update Xcode to Version 12.5 (12E262), which is the latest one. And I get this same error. Does it means I need to do
xcode-select --install
each time manually? -
AnandShiva almost 3 yearsAccording to the XCode man pages(Yea they do have documentation!!!) ``` -r, --reset Unsets any user-specified developer directory, so that the developer directory will be found via the default search mecha- nism. This command must be run with superuser permissions (see sudo(8)), and will affect all users on the system. ```
-
pawelswiecki almost 3 years
xcode-select --install
+ terminal restart fixed broken git after Catalina -> Big Sure update! -
Cameron Hudson almost 3 yearsI've (re)installed xcode so many times over the past 2 years that it's like "How many times do I have to teach you this lesson, old man?"
-
newbie almost 3 yearsThanks - worked for me! Why do MacOS upgrades always break dev tools? Disincentivizes upgrading since this is my dev laptop.
-
newbie almost 3 yearsThanks - worked for me! Why do MacOS upgrades always break dev tools? Disincentivizes upgrading since this is my dev laptop.
-
pasha.zhukov almost 3 yearsSmells like Microsoft developers injection
-
jacksonbenete almost 3 yearsThis is working for BigSur as well as the Monterey beta branch. Way easier than downloading and installing giant new Xcode releases each time you update.
-
MT_Shikomba almost 3 yearsThanks, solution #1 worked for me, am on PHPStorm.
-
Jesse over 2 yearsSolution 1 worked for me running macOS 11.5.1. Thank you :D
-
Purushotham Kumar over 2 yearsGetting below error on BigSur ➜ ~ sudo xcodebuild -license dyld: dyld cache load error: existing shared cache in memory is not compatible dyld: Library not loaded: /System/Library/Frameworks/Foundation.framework/Versions/C/Foundation Referenced from: /Applications/Xcode.app/Contents/Developer/usr/bin/xcodebuild Reason: image not found xcrun: error: unable to locate xcodebuild, please make sure the path to the Xcode folder is set correctly! xcrun: error: You can set the path to the Xcode folder using /usr/bin/xcode-select -switch
-
OneCricketeer over 2 yearsPlease don't repeat existing answers
-
wegry over 2 yearsThis did not work on Monterey.
-
shoaib30 over 2 years3 years later, the solution still works for Monterey! thanks
-
Luan Cardoso over 2 yearson the update to monterey, it worked like a charm (xcode-select --install). Thank you so much!!
-
Silvia42 over 2 yearsI updated from macOS Big Sur -> macOS Monterey, Nov 01, 2021. Same problem with git:
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
. This installation solved the problem:xcode-select --install
THANK YOU!!! -
VirtualWolf over 2 yearsThis did the trick for me and fixed VSCode not finding Git after I migrated from my old iMac running Catalina to my shiny new Apple Silicon MacBook Pro running Monterey via Migration Assistant.
-
Samuel Nde over 2 yearsI cannot believe this problem has not been solved in November 2021. Apple WTH?
-
Thomas Beauvais over 2 yearsTry
sudo xcode-select --reset
first then--install
-
Anand over 2 yearsHad a same problem and this works :)
-
Erich Meissner over 2 yearsI updated recently to MacOS Monterey , and this update of xcode tools was able to fix this exact same issue. Thank you.
-
Kamlesh over 2 yearsNo need to download Xcode. I am using MacOS Monterey version 12.x. I have downloaded "Command Line Tools for Xcode 13.3 beta". Restarted terminal and command line is working along with github clone/pull/push issues. It worked like charm.
-
ChrisRich about 2 yearsI never understood why XCode is required for git or why it interferes with my git installation in the first place. I tried to uninstall Xcode completely to avoid this situation, but that did not work out well
-
Eric Manley about 2 yearsFor iOS Monterey, I went with 13.3.1. And git started working again.
-
Cuauhtli about 2 yearsUpdate 2022: works on Darwin 21.4.0
-
alianos- about 2 yearsThat is the same with the accepted answer, but with less information!
-
Xab Ion about 2 yearsWorks perfect with macOS Catalina
-
Flavien about 2 yearsWow, this is ridiculous. Why do I have to download several gigs just to use git?
-
Matt West almost 2 yearsMy first dev job was in .Net. I remember thinking Visual Studio was huge and invasive. It's got nothing on Xcode.
-
dustbuster almost 2 yearsYep I feel the same way! I learned how to code in college using Visual Studio. Now if I accidentally double click a file that's registered to open with Xcode I go right for the force quit! Do not pass go and no 200 bucks for you!