Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

"Failed to extract git version" CocoaPods using Mac [duplicate]

I get this error:

xcrun: error: invalid active developer path (/Applications/Xcode.app), missing xcrun at: /Applications/Xcode.app/usr/bin/xcrun

This solution works, but the error occurs again after closing my terminal and reopening it; I then have to run the same commands every time I open a new terminal window.

How can I apply these changes such that they will save after closing the terminal window out?

like image 431
David Lambl Avatar asked Feb 24 '15 21:02

David Lambl


5 Answers

I started getting the same error after updating to OS X El Capitan.
In my case, all I did was to install it:

sudo xcode-select --install

And it works fine for me.

like image 102
Shuvo Avatar answered Oct 17 '22 09:10

Shuvo


[Update] The steps below are for OS X 10.10 (Yosemite). Those experiencing this because of an upgrade to 10.11 (El Capitan) seem need to only run sudo xcode-select --install as described in the accepted answer.

I found a suggestion here which indicated

sudo xcode-select -switch /

as the fix. However, this threw an error that the developer path was invalid.

Instead, for me, I modified this to

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer/

(which is a mixture of the two referenced link solutions) and this worked.

[Edit]

Try using

xcode-select --print-path

to find your developer path if /Applications/Xcode.app/Contents/Developer/ is still invalid for you.

like image 42
David Lambl Avatar answered Oct 17 '22 09:10

David Lambl


I know this is quite old but I got the same issue and then I fixed it by doing couple more extra steps. Problem came when Terminal could not find the actual path of the Command Line Tools.

  1. If you had Xcode and then removed it, then Terminal is referring to the Command Line Tools inside the Xcode folder. Try using this command and check what your path is, xcode-select --print-path. This would most likely print /Applications/Xcode.app/Contents/Developer.
  2. Now to fix this, reinstall the command line tools for xcode. Initially remove any previous installations using sudo rm -rf /Library/Developer/CommandLineTools.
  3. Then install the command line tools sudo xcode-select --install Now the final step, change the path for the CLT to the actual path using sudo xcode-select -switch /Library/Developer/CommandLineTools/ this will fix it.
like image 24
RinW Avatar answered Oct 17 '22 07:10

RinW


I resolved the issue with the below steps.

Xcode -> Preferences -> Locations -> Command Line Tools -> Select the command tool matching your Xcode version.

like image 21
Kumar C Avatar answered Oct 17 '22 09:10

Kumar C


I started getting the same error after i update macOS Mojave to macOS Catalina.

I just installed few command lines in Terminal,

 1. $ sudo gem install cocoapods
 2. $ sudo xcode-select --install
 3. $ chsh -s /bin/zsh

Then,

Xcode -> Preferences -> Locations -> Command Line Tools and confirm you have current Xcode version selected there.

And it works fine with me. Thanks!!

like image 14
Anjali Kevadiya Avatar answered Oct 17 '22 08:10

Anjali Kevadiya