Eternal Rubyist
Eternal Rubyist

Reputation: 3615

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)

Upvotes: 21

Views: 42920

Answers (10)

Chamin  Thilakarathne
Chamin Thilakarathne

Reputation: 447

try using

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

and then

sudo gem install cocoapods --source http://rubygems.org

Upvotes: 0

Michael McKenna
Michael McKenna

Reputation: 794

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>

Upvotes: 0

Sohaib Aslam
Sohaib Aslam

Reputation: 1315

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

Upvotes: 2

Hamza Waleed
Hamza Waleed

Reputation: 1462

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

Upvotes: 1

user3566863
user3566863

Reputation: 253

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

Upvotes: 13

UKDataGeek
UKDataGeek

Reputation: 6902

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..

Upvotes: 2

taojigu
taojigu

Reputation: 457

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

Upvotes: 38

Teja Swaroop
Teja Swaroop

Reputation: 1159

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

Upvotes: 28

Jack.Gang
Jack.Gang

Reputation: 1

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

Upvotes: -1

Eternal Rubyist
Eternal Rubyist

Reputation: 3615

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.

Upvotes: 3

Related Questions