Getting frequent Gem RemoteFetcher::FetchError. Any workarounds?

17,347

Solution 1

What I wound up doing was to download the rdoc 3.12 gem to my desktop (based on the original error), then installed it with...

$ gem install --local ~/Desktop/rdoc-3.12.gem

Then I ran $ gem install rails again, and it finished up successfully.

Solution 2

Make sure your rvm ssl certificates are up to date.

Check their status

$ rvm osx-ssl-certs status all

Update them!

$ rvm osx-ssl-certs update all

Solution 3

You have to add the "http://rubygems.org",

but before that remove the https source because as it will get stuck at the certificate error and add http instead.


so by steps would be:

  1. gem sources - check sources
  2. gem sources -a http://rubygems.org/ - will add http source
  3. gem sources --remove https://rubygems.org/ - will remove the https source

Solution 4

Any reason for not having RubyGems in your sources? If not, add it with

gem sources -a http://rubygems.org

and try again.

Solution 5

I'd try leaving only rubygems.org as the only gem source. This should help.

Share:
17,347
the1
Author by

the1

Updated on July 27, 2022

Comments

  • the1
    the1 almost 2 years

    I've been getting this error frequently every day for the last few days...

    $ gem install rails -v 3.2.1
    ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
        bad response Forbidden 403 (http://production.cf.rubygems.org/gems/rdoc-3.12.gem)
    

    My understanding based on a previous question is that this is due to a problem with the remote repository and the solution is to just wait a little while and try again. Indeed, sometimes when I wait a few hours or overnight the install command works.

    However, I'm hoping for a more reliable experience.

    I thought of downloading files such as rails-3.2.1.gem and then running...

    $ gem install --local ~/Desktop/rails-3.2.1.gem
    

    But that gives me...

    $ gem install --local ~/Desktop/rails-3.2.1.gem 
    ERROR:  While executing gem ... (Gem::DependencyError)
        Unable to resolve dependencies: rails requires railties (= 3.2.1)
    

    I could try downloading railties. Maybe I will. But I sense a plunge down a rabbit hole there of searching out dependency after dependency all day long.

    Any alternate efficient ways to install gems? Is there something I could do through my repository specification that would allow gem installation to be more reliable?


    $ gem environment
    RubyGems Environment:
      - RUBYGEMS VERSION: 1.8.15
      - RUBY VERSION: 1.9.2 (2011-07-09 patchlevel 290) [x86_64-darwin11.2.0]
      - INSTALLATION DIRECTORY: /Users/ethan/.rvm/gems/ruby-1.9.2-p290@rails_3_for_mtc
      - RUBY EXECUTABLE: /Users/ethan/.rvm/rubies/ruby-1.9.2-p290/bin/ruby
      - EXECUTABLE DIRECTORY: /Users/ethan/.rvm/gems/ruby-1.9.2-p290@rails_3_for_mtc/bin
      - RUBYGEMS PLATFORMS:
        - ruby
        - x86_64-darwin-11
      - GEM PATHS:
         - /Users/ethan/.rvm/gems/ruby-1.9.2-p290@rails_3_for_mtc
         - /Users/ethan/.rvm/gems/ruby-1.9.2-p290@global
      - GEM CONFIGURATION:
         - :update_sources => true
         - :verbose => true
         - :benchmark => false
         - :backtrace => false
         - :bulk_threshold => 1000
         - :sources => ["http://rubygems.org"]
         - "gem" => "--no-rdoc --no-ri"
         - "install" => "--no-rdoc --no-ri"
         - "update" => "--no-rdoc --no-ri"
      - REMOTE SOURCES:
         - http://rubygems.org
    
  • the1
    the1 about 12 years
    I've set rubygems.org as the source. I'm still getting the same error.
  • the1
    the1 about 12 years
    Thanks, I did make that update, but still getting the same result.
  • Jim
    Jim over 11 years
    If this was the issue, it wouldn't work for him after he waits "a few hours or overnight" to retry the operation
  • Bennett Smith
    Bennett Smith over 10 years
    This is a very valuable tip. I was experiencing issues with getting "bundle install" to work properly. It kept reporting the following issue: Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (rubygems.global.ssl.fastly.net/gems/json_pure-1.8.1.gem) An error occurred while installing json_pure (1.8.1), and Bundler cannot continue. Make sure that gem install json_pure -v '1.8.1' succeeds before bundling. This resolved the issues for me! Thanks.
  • springloaded
    springloaded about 8 years
    Thanks, this solved it for me, it should be the accepted answer
  • devius
    devius about 8 years
    For those wondering, no this does not work on Linux. To be more specific the first command works, but the second one doesn't.
  • Andrew Lobban
    Andrew Lobban about 8 years
    I up'ed because this was worked for my issue. I was getting SSL connection issues and removing the https resolved my issue.