19

When i try to initialize pod file to use cocoapods via terminal, it gives me this error. How to fix it.

/Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.0/lib/cocoapods/command.rb:128:in `verify_minimum_git_version!': [!] You need at least git version 1.8.5 to use CocoaPods (Pod::Informative)
Krunal
  • 77,632
  • 48
  • 245
  • 261
Usama bin Attique
  • 337
  • 1
  • 3
  • 16
  • I have done it already, and the gems are installed successfully the problem im having is when i am trying to initialize pod file in my xcode project. – Usama bin Attique Feb 02 '17 at 07:33
  • Try to update git version as the error show `You need at least git version 1.8.5 to use CocoaPods` – nynohu Feb 02 '17 at 07:37
  • [This](https://medium.com/@katopz/how-to-upgrade-git-ff00ea12be18#.oh5431frd) may help. – Mohammad Zaid Pathan Feb 02 '17 at 07:38
  • @ZaidPathan its a nice link and i have installed homebrew and installed git but its not linking. its giving me this error Error: Could not symlink bin/git Target /usr/local/bin/git already exists. You may want to remove it: rm '/usr/local/bin/git' To force the link and overwrite all conflicting files: brew link --overwrite git To list all files that would be deleted: brew link --overwrite --dry-run git – Usama bin Attique Feb 02 '17 at 08:04
  • and i have tried to remove it and overwrite it as well but it wont link, it says Error: Could not symlink share/git-core/contrib /usr/local/share/git-core is not writable. – Usama bin Attique Feb 02 '17 at 08:05
  • 1
    I believe [This](http://stackoverflow.com/a/25706947/3411787) or [This](http://stackoverflow.com/a/29109247/3411787) should work. – Mohammad Zaid Pathan Feb 02 '17 at 09:38

9 Answers9

62

I encounter the same problem and solve it by using the following command:

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

As the error message in terminal shows, something with my git goes wrong. And, it has to do with the command line tool.

Satan Pandeya
  • 3,747
  • 4
  • 27
  • 53
Guohua Cheng
  • 943
  • 7
  • 15
31

I was having an issue while trying to install packages using cocoapods. I have tried "sudo xcode-select --switch /Applications/Xcode.app" still getting wrong path error

To fix this

I opened Xcode.

Preferences
Locations
Selected the Command Lin Tools: Xcode 9.0

Now when installing packages with cocoapods I no longer get errors.

Joyal Clifford
  • 1,212
  • 11
  • 20
4

You need to set command line tool version, in Xcode:

You can download latest command line tool from Apple Download Portal, if you have paid apple developer account/id.


Here are current beta and stable Xcode Tool and supporting command line tool download link. (Ensure you'are logged in using premium developer account on Apple Developer Account to access these links)

Xcode 11

Xcode 10

Once you've latest command line tool installed in your system, set it from Xcode Menu.

(Xcode Menu Items) Xcode ▶ Preferences ▶ Location ▶ Command Line Tool ▶ Select appropriate command line tool

enter image description here

Krunal
  • 77,632
  • 48
  • 245
  • 261
2

If you have upgraded your MAC from the App Store, then you need to run: xcode-select --install

When I ran git --version before running the command above, it didn't find git at all. It displayed this error: missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun. So, I'm guessing when I upgraded my machine somehow I lost git. Regardless, running the above command worked.

I then ran git --version and it showed the git version that was installed.

Reference: http://tips.tutorialhorizon.com/2015/10/01/xcrun-error-invalid-active-developer-path-library-developer-commandline-tools-missing-xcrun/

Sandy D.
  • 3,166
  • 1
  • 20
  • 31
2

After installing OS Mojave and installed new Xcode tools i just had to check again the tools in:

Xcode > Preferences > Locations > Command Line tools = Xcode 10.0

FBC
  • 1,047
  • 8
  • 18
1

Sometimes its version issue.

Installing CoacoaPods 1.7.5 did the trick.

sudo gem uninstall cocoapods
sudo gem install cocoapods -v 1.7.5
pod setup
0

Hey this might help you!!! I followed this link

https://stackoverflow.com/a/16664135/7905401

After installing command line tools i closed it and opened terminal again now when i checked version git --version it gave me update version 2.10.0 then i ran other commands for cocoapod!! its working!!!!!!!!! yeeeii!!!!

Community
  • 1
  • 1
Waaheeda
  • 394
  • 3
  • 14
0

I fixed the problem with next steps:

sudo gem install cocoapods --source http://rubygems.org

after command finish entering new command

pod install

and work for me on xCode 11.2

Ibrahim Sušić
  • 438
  • 3
  • 20
-1

I followed this

After installing command line tools, I closed it and opened terminal again. Now when I checked version git --version, it gave me update version 2.10.0 then I ran other commands for cocoapod.

Now it is working.

pacholik
  • 8,607
  • 9
  • 43
  • 55
Waaheeda
  • 394
  • 3
  • 14
  • what have you followed? – Ramcharan Reddy Sep 06 '17 at 10:36
  • @RamcharanReddy After installing command line tools, I closed it and opened terminal again. Now when I checked version git --version, it gave me update version 2.10.0 then I ran other commands for cocoapod. This worked for me. – Waaheeda Sep 08 '17 at 06:27