change xcrun developer path for Android Studio/IntelliJ
Asked Answered
P

5

67

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

Planetstruck answered 23/7, 2015 at 6:27 Comment(0)
V
78

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.

Vanvanadate answered 28/10, 2015 at 8:44 Comment(5)
Saved my time indeed! Thanks @Atrix1987Ogdoad
This should be marked answer. He asked for android studio and he marked for Xcode answer. I dont know what was wrong with him? By the way thanks for solution.Emir
After the update to macOS Mojave, this was exactly the suggestion in Android Studio, to install git from this link. But your answer helped with quickly setting the correct path.Tenacious
update 2020: just happened to me after Catalina update, 2018 MBP. Installed git with homebrew, the path was: /usr/local/bin/gitOzan
thanks Man ,i waste so much time to download and install Xcode with no solutions .Second
K
110

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.

Kleptomania answered 24/7, 2015 at 4:31 Comment(5)
Thanks for this, but i am not using XCode, i am using Android StudioPlanetstruck
I should have noted that I am not using Xcode for development, either. I am using IntelliJ. A version of git and xcrun is distributed as part of Xcode Command Line Tools (which is where it appears your git is currently configured to be executed from). If you installed git on your own (e.g., /usr/local/bin), perhaps your alias needs to be reconfigured for git to point to your installation instead of the default.Kleptomania
Running xcode-select --install to install Xcode Command Line Tools fixed git for me. No need to install the whole Xcode.Dried
The answer is also useful for final version of El Capitan. It makes git working.Woodbridge
This seems to happen every few Apple OS releases. I wonder if they're aware of it.Turkish
V
78

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.

Vanvanadate answered 28/10, 2015 at 8:44 Comment(5)
Saved my time indeed! Thanks @Atrix1987Ogdoad
This should be marked answer. He asked for android studio and he marked for Xcode answer. I dont know what was wrong with him? By the way thanks for solution.Emir
After the update to macOS Mojave, this was exactly the suggestion in Android Studio, to install git from this link. But your answer helped with quickly setting the correct path.Tenacious
update 2020: just happened to me after Catalina update, 2018 MBP. Installed git with homebrew, the path was: /usr/local/bin/gitOzan
thanks Man ,i waste so much time to download and install Xcode with no solutions .Second
A
5

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

Anagnos answered 5/1, 2019 at 21:28 Comment(0)
F
1

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

Formication answered 14/6, 2018 at 17:6 Comment(0)
S
1

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.

Subterranean answered 12/11, 2018 at 14:55 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.