change xcrun developer path for Android Studio/IntelliJ

GitAndroid StudioIntellij IdeaOsx ElcapitanXcrun

Git Problem Overview


I'm using GIT and am trying to push my code and getting the following error when using the Terminal. I don't use XCode, I'm using Android Studio.

The command I tried using was:

> git branch Networking

Error:

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

I am running on El Capitan Beta 4 update if that helps in any way.


> Update: This also happens for IntelliJ users, and for MacOS > Catalina update

Git Solutions


Solution 1 - Git

I ran into the same problem, however with svn. I found that by installing El Capitan, Xcode was "uninstalled". I reinstalled Xcode from the App Store and then reinstalled Xcode Command Line Tools via Terminal with

xcode-select --install

After installation, my /Library/Developer/CommandLineTools/usr/bin directory reappeared and svn started working again.

Solution 2 - Git

Instead of installing xcode you can install git from here and change the path in android studio to /usr/local/git/bin/git as shown in the image below.

studio preferences

This way you save time and memory.

Solution 3 - Git

Use /usr/local/git/bin/git as a path

Solution 4 - Git

In my case, Git did not work after upgrading Mac OS X High Sierra.

Fortunately, the answer provided by @Rob still works for High Sierra, so there was no need for me to actually change the xcrun developer path and no need to install all of XCode

Solution 5 - Git

I lost Git after upgrading to macOS Mojave.

The solution of re-installing XCode CLI still works fine.

In Terminal, type:

xcode-select --install

... and click "Install" on the prompt.

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionStillieView Question on Stackoverflow
Solution 1 - GitRobView Answer on Stackoverflow
Solution 2 - GitAbhishek NandiView Answer on Stackoverflow
Solution 3 - GitJasur ShukurovView Answer on Stackoverflow
Solution 4 - GitPhileo99View Answer on Stackoverflow
Solution 5 - GitFloTView Answer on Stackoverflow