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

10

21

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)

Jeanmariejeanna answered 26/10, 2013 at 21:39 Comment(1)
Make sure your network connection is alright. The command might not work if you are using office network.Rosenfeld
J
3

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.

Jeanmariejeanna answered 27/10, 2013 at 15:25 Comment(0)
V
38

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
Vorster answered 26/9, 2014 at 9:7 Comment(5)
$ gem sources -a ruby.taobao.org Error fetching ruby.taobao.org: bad response Not Found 404 (ruby.taobao.org/specs.4.8.gz)Solicitous
Sorry , it should be "httpS://ruby.taobao.org"Vorster
Even with "httpS://ruby.taobao.org" => Error fetching ruby.taobao.org: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (rubygems-china.oss-cn-hangzhou.aliyuncs.com/specs.4.8.gz)Plane
What is taoboa.org?? is that source reliable at all??Adeline
I don't trust the source "taobao.org". How else can I solve this problem?Tillage
L
28

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
Ligialignaloes answered 17/8, 2016 at 7:8 Comment(1)
I have removed a superfluous brew install cocoapods from your steps.Ailing
B
12

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
Batsman answered 9/9, 2018 at 2:39 Comment(3)
Worked for me, but it's not ideal since I'd prefer to use https. And to save some head scratching don't forget the trailing / at the end of the URLsShew
My god, this is stupidly simple solution that I've never thought!Picasso
Thanks for this simplest solution! IAfter that I removed the http and set back the https.Lysias
J
3

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.

Jeanmariejeanna answered 27/10, 2013 at 15:25 Comment(0)
U
2

I found that just removing and re-adding rubygems seemed to work for me ( using the High Sierra on Mac) I prefer to use the official Rubygems repos

gem sources -r https://rubygems.org/
gem sources -a https://rubygems.org/
gem sources -u
sudo gem install cocoapods

I assume it must have been a glitch..

Uncritical answered 10/8, 2018 at 9:15 Comment(0)
O
2

Just follow there steps and error is gone

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 cocapods using home-brew, it take care of everything

brew install cocoapods

4. Last step

pod setup
Operculum answered 6/12, 2019 at 12:43 Comment(0)
B
1

This worked for me. Make sure to include sudo with install command.

gem sources -a http://rubygems.org/
gem sources -u
sudo gem install cocoapods
Birthday answered 17/7, 2019 at 18:6 Comment(0)
M
0

For me I had to change rubygems.org to be the gems url used at my company (which caches from rubygems.org).

I did sudo gem install cocoapods --source <my_company_url_for_gems>

Metro answered 28/2, 2020 at 18:49 Comment(0)
F
0

try using

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

and then

sudo gem install cocoapods --source http://rubygems.org
Frizzle answered 15/10, 2023 at 4:52 Comment(0)
M
-1

Let all http replace https,because the right cocoa pods's sources is https://ruby.taobao.org/

Milepost answered 25/2, 2016 at 6:30 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.