Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Getting error in setting up Cocoa Pods and install update for Ruby

I am trying to setup cocoapods to my iOS application But when I go for command:

sudo gem update --system

I get error : Latest version currently installed. Aborting.

When I go to next step for cocoapods:

sudo gem install cocoapods

I get error on Mac OS 10.8.5 :

ERROR:  Error installing cocoapods:
cocoapods-trunk requires Ruby version >= 2.0.0. 

I tried same on Mac OS 10.9.4 and getting error :

ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
      Unable to download data from https://rubygems.org/ - Errno::ECONNREFUSED: Connection refused - connect(2) (https://rubygems.org/latest_specs.4.8.gz)​
like image 962
Shekhar Sharma Avatar asked Mar 03 '15 09:03

Shekhar Sharma


People also ask

Do I need Ruby to install CocoaPods?

Cocoapods is built on top of Ruby, so you would need to install that in your system before using Cocoapods.

What version of Ruby does CocoaPods use?

CocoaPods is built with Ruby and it will be installable with the default Ruby available on macOS. You can use a Ruby Version manager, however we recommend that you use the standard Ruby available on macOS unless you know what you're doing.

How do I update my CocoaPods iOS?

When you run pod update PODNAME , CocoaPods will try to find an updated version of the pod PODNAME , without taking into account the version listed in Podfile. lock . It will update the pod to the latest version possible (as long as it matches the version restrictions in your Podfile ).


1 Answers

I had this same problem and found it was due to having an older version of Ruby installed (even though my OS X is 10.10.2). You will need to uninstall the old version and install a newer version of Ruby. These steps worked for me:

  1. Try rvm ls to see if you have a newer version installed. If you do, just use it with rvm use ruby-2.2.0, for example.

  2. If you don't have an unused compatible version, uninstall the old version: rvm uninstall [your ruby version] (you may have to uninstall cocoapods first if this line gives you an error). Use rvm current to see what version you're running.

  3. Install version 2.2.0 (or use rvm list known to see all available versions; 2.2.0 worked for me, but 2.2-head did not): rvm install ruby-2.2.0

  4. When it's done: rvm --create ruby-2.2.0, and then rvm use ruby-2.2.0

  5. Reinstall cocoapods

like image 95
iKe Avatar answered Nov 15 '22 04:11

iKe