Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to install 'cocoapods' gem from rubygems.org (bad response backend read error)

I'm getting an error when I run 'gem install cocoapods' on OSX Mavericks.

$ gem install cocoapods
ERROR:  Could not find a valid gem 'cocoapods' (>= 0), here is why:
          Unable to download data from https://rubygems.org/ - bad response backend read error 503 (https://rubygems.global.ssl.fastly.net/quick/Marshal.4.8/cocoapods-0.27.1.gemspec.rz)
ERROR:  Possible alternatives: cocoapods

Please note that I can download the cocoapods-0.27.1.gemspec.rz directly. I am running the latest version of XCode (5.0.1) and the latest version of its CLI tools. RVM is also configured to run the latest Ruby version (2.0.0p247)

like image 933
depthfirstdesigner Avatar asked Oct 26 '13 21:10

depthfirstdesigner


People also ask

Where does gem install CocoaPods?

You'll have seen gem install xxx . These are installed into a central database of versions. If you imagine that CocoaPods installs all libraries/frameworks into a System folder and they are linked at runtime, then you have the rough idea of how RubyGems keeps all the gems.

Should I install CocoaPods with GEM or homebrew?

If you try to install a gem through pre-installed Ruby, you've to use sudo by default witch is not a good practice. Another option is to install CocoaPods in your user-level directory by following instructions available on the Sudo-less installation section. I would suggest you install CocoaPods using brew .

What is Ruby gem CocoaPods?

0. CocoaPods manages library dependencies for your Xcode project. You specify the dependencies for your project in one easy text file. CocoaPods resolves dependencies between libraries, fetches source code for the dependencies, and creates and maintains an Xcode workspace to build your project.


4 Answers

Sometimes ,the default source for gem, https://rubygems.org/, can't be accessed.

It should be removed by command:

gem sources -r https://rubygems.org/

And then new source should be added:

gem sources -a https://ruby.taobao.org/

Update the cache:

gem sources -u

You can check sources with:

gem sources

Finally , you can install cocoapods:

sudo gem install cocoapods
like image 52
taojigu Avatar answered Sep 24 '22 13:09

taojigu


Use the below mentioned steps to install Cocoapods in your machine, I solved the same issue with be below mentioned steps

1.Install command line tools using the command

xcode-select --install

2.Install Home brew by

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

3.Install Ruby using homebrew

brew install ruby

4.Check Ruby version

ruby -v

5.Install Ruby

gem source -a http://rubygems.org/

6.gem install cocoapods

sudo gem install cocoapods

or

sudo gem install -n /usr/local/bin cocoapods

7.Go to below folder

cd ~/.cocoapods/repos

8.Run the below command

git clone https://github.com/CocoaPods/Specs.git master

9.Go to the directory where Podfile is present and run

pod install
like image 23
Teja Swaroop Avatar answered Sep 26 '22 13:09

Teja Swaroop


It work for me:

Remove https source by command:

gem sources -r https://rubygems.org/

And then new http source should be added:

gem sources -a http://rubygems.org/

Update the cache:

gem sources -u
like image 40
user3566863 Avatar answered Sep 26 '22 13:09

user3566863


Though I'm not sure what caused read error 503 I was able to work around the problem fairly easily by manually installing the cocoapods.gem.

If anyone else experiences similar problems (with cocoapods or any other gem), download the appropriate gem file (cocoapods-0.27.1.gem in my case) directly from RubyGems.org. Then run the gem install cocoapods-0.27.1.gem. The install command will scan the working directory first, thus detecting and installing the local gem package, cutting out the broken repository.

like image 25
depthfirstdesigner Avatar answered Sep 25 '22 13:09

depthfirstdesigner