5

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)​
Shekhar Sharma
  • 85
  • 2
  • 10
  • When trying to install ruby and rvm, I am getting error : RVM sourcing line not found for Zsh, rerun this command with '--auto-dotfiles' flag to fix it. and warning : * WARNING: You have '~/.profile' file, you might want to load it, to do that add the following line to '/Users/sharmas7/.bash_profile': source ~/.profile and error for ruby: No binary rubies available for: osx/10.8/x86_64/ruby-2.0.0-p598 – Shekhar Sharma Mar 11 '15 at 09:27

1 Answers1

9

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

iKe
  • 241
  • 2
  • 4