"pod init" creates error that says "You need at least git version 1.8.5 to use CocoaPods"

23,726

Solution 1

Firstly remove the existing git in your system using commands:-

Use command "which git" that will give u the path say "/usr/local/bin/git", then use command->$ sudo rm -rf /usr/local/bin/git

This will remove existing git from your system Then reinstall git again

$ brew install git

It might issue a warning saying Warning: git 2.13.2 is already installed, it's just not linked. You can use `brew link git` to link this version.

Then run below mentioned command:-

$ sudo chown -R $(whoami) /usr/local/share/
$ sudo chown -R $(whoami) /usr/local/lib
$ brew link --overwrite --dry-run git

It might give you error Error: Could not symlink share/git-core/templates/description Target /usr/local/share/git-core/templates/description already exists. You may want to remove it: rm '/usr/local/share/git-core/templates/description'

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

Then finally run command

$ brew link --overwrite git

This is how I updated my git and pod init worked. Hope you find it helpful :)

Solution 2

It needs to set your command line tool version, in your Xcode (Preferences).

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


Here are current stable and beta Xcode Tools and supporting command line tool download links. (Ensure you're 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

enter image description here

Solution 3

I had a similar issue after installing a second Xcode. As a result there was no command line tools specified in xcode-select -p

Fixed by manually choosing newer Xcode version

Solution 4

Do as suggested below and it will fix this issue:

Xcode Preferences -> Locations -> Selected the Command Lin Tools: select Xcode 8.3 or whatever you want to select.

Step-1: enter image description here

Step-2: enter image description here

Hope it will fix your issue!!!

Share:
23,726

Related videos on Youtube

Ishika
Author by

Ishika

Mobile App Development: Mobile App Consultancy, iPhone App Development, Android App Development, UI/UX Design, Quality Assurance, Internet of Things, React Native App Development Web Designing & Development: We help business and ideas across the globe by Building Scalable & Secure Web Applications using best and latest technologies. We work in:- Product Design, Development, Quality Assurance, Maintenance Server Management We help businesses to move into Best, Secure and cost efficient Cloud services available based on their needs and demand. We work in:- Amazon AWS, Google Cloud Platform, Firebase, Digital Ocean Digital Marketing On Page Seo, Sitemap.Xml Test, Google Pagespeed Score Test, Favicon Test, Structured Data Test, Google Adword, Meta Title, Meta Descriptions, Internal Linking Test, Ror.xml and Urllist.txt Test, Site Loading Speed Test Off-Page Include: Social Media Optimization, Article Posting, Classified Postings, Strong Press Release Distribution, Social Bookmarking Submissions, Business Listing(Local Listings), Yahoo Question Answering, Directory Submission, RSS Feed Submission, Review Listings, Link Re-enforcement, Link Wheel Creation, Blog Commenting, Content Optimization.

Updated on July 09, 2022

Comments

  • Ishika
    Ishika almost 2 years

    I was not able to install any pod in my system. Hence, I removed cocoapods from my Mac and then reinstalled it. The process was successful but when I run the command pod init following error shows up in the terminal:

    `verify_minimum_git_version!': [!] You need at least git version 1.8.5 to use CocoaPods (Pod::Informative)
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/lib/cocoapods/command.rb:49:in `run'
    from /Library/Ruby/Gems/2.0.0/gems/cocoapods-1.2.1/bin/pod:55:in `<top (required)>'
    from /usr/local/bin/pod:23:in `load'
    from /usr/local/bin/pod:23:in `<main>'
    

    I also checked my Git version which was 1.8.4 but I am getting any solution to update the same.

    • KKRocks
      KKRocks almost 7 years
      Try this :Xcode Preferences -> Locations -> Selected the Command Lin Tools: select Xcode 8.3 or run this command sudo xcode-select --switch /Applications/Xcode.app
    • Ishika
      Ishika almost 7 years
      Already did this, not working :(
    • Dharma
      Dharma almost 7 years
    • Vignesh Davins
      Vignesh Davins almost 7 years
      @IshikaCheck this one Pod file not being initialized ?
    • Ishika
      Ishika almost 7 years
      @VigneshDavins: Tried Already
  • Ishika
    Ishika almost 7 years
    Thank you pradeep, your solution worked well for me. Moreover, I also had to create master using command "$ git clone github.com/CocoaPods/Specs.git master" and do the cloning in order to install pod.
  • Rob T
    Rob T over 6 years
    This worked for me! For anyone else attempting to fix the issue this way on the command line - the command to manually choose the newer version of Xcode is sudo xcode-select --switch /path/to/latest/Xcode.app (the command must be run as root)
  • Kunal Gupta
    Kunal Gupta about 6 years
    that's sweeeeet.
  • Boris Gafurov
    Boris Gafurov about 6 years
    i did by Krunal who identically suggested it 4 month before you
  • Womble
    Womble about 6 years
    Before doing this, please see Krunal's answer. You may not need to perform this at all.
  • Jan
    Jan about 6 years
    Perfect answer, This should be marked as right answer.
  • Roohul
    Roohul almost 6 years
    This should be marked as correct answer. I checked there were no command line tool specified in my XCode by just setting it worked. Thanks a lot
  • Egzon P.
    Egzon P. over 5 years
    For those who want to get xcode location munally: 1) Open terminal 2) Drag and drop xcode on terminal 3) Terminal will write your xcode location for example: /Applications/Xcode 4) Select with mouse cursor the text you want to copy, in this case location of xcode. Than your run: sudo xcode-select --switch /Applications/Xcode
  • Ahsan Ebrahim
    Ahsan Ebrahim over 5 years
    Perfect. Im extremely scared of pods issues yet. Thanks for saving me from a panic attack :D +1 for sure.
  • Umair_UAS
    Umair_UAS over 4 years
    This should be the perfect answer. Thank you @KunalGupta (Y)