简体   繁体   中英

SSL error with Rubygems (unable to connect)

I've installed a fresh version of ruby 2.3.3 via RVM and I'm attempting to install rails ( gem install rails ) however, when I do I receive the following error:

ERROR: Could not find a valid gem 'rails' (>= 0), here is why: Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=error: certificate verify failed ( https://api.rubygems.org/specs.4.8.gz )

I have followed the instructions on the SSL cert page on rubygem to no avail. Every cert I can find within rubygems seems to match the most recent version.

I have also run gem update --system and receive the following error:

ERROR:  While executing gem ... (Gem::RemoteFetcher::FetchError)
        SSL_connect returned=1 errno=0 state=error: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)

Lastly, here is the output of `gem env`:

 RubyGems Environment:
  - RUBYGEMS VERSION: 2.5.2
  - RUBY VERSION: 2.3.3 (2016-11-21 patchlevel 222) [x86_64-darwin14]
  - INSTALLATION DIRECTORY: /Users/adammay/.rvm/gems/ruby-2.3.3
  - USER INSTALLATION DIRECTORY: /Users/adammay/.gem/ruby/2.3.0
  - RUBY EXECUTABLE: /Users/adammay/.rvm/rubies/ruby-2.3.3/bin/ruby
  - EXECUTABLE DIRECTORY: /Users/adammay/.rvm/gems/ruby-2.3.3/bin
  - SPEC CACHE DIRECTORY: /Users/adammay/.gem/specs
  - SYSTEM CONFIGURATION DIRECTORY: /Users/adammay/.rvm/rubies/ruby-2.3.3/etc
  - RUBYGEMS PLATFORMS:
    - ruby
    - x86_64-darwin-14
  - GEM PATHS:
     - /Users/adammay/.rvm/gems/ruby-2.3.3
     - /Users/adammay/.rvm/gems/ruby-2.3.3@global
  - GEM CONFIGURATION:
     - :update_sources => true
     - :verbose => true
     - :backtrace => false
     - :bulk_threshold => 1000
     - "gem" => "--no-ri --no-rdoc"
  - REMOTE SOURCES:
     - https://rubygems.org/
  - SHELL PATH:
     - /Users/adammay/.rvm/gems/ruby-2.3.3/bin
     - /Users/adammay/.rvm/gems/ruby-2.3.3@global/bin
     - /Users/adammay/.rvm/rubies/ruby-2.3.3/bin
     - /Users/adammay/.rvm/bin
     - /Applications/Postgres.app/Contents/Versions/9.4/bin
     - /usr/local
     - /usr/local/bin
     - /usr/local/sbin
     - /usr/bin
     - /usr/local/bin
     - /usr/bin
     - /bin
     - /usr/sbin
     - /sbin

You can try to do this, it can fix your problems.

gem update --system --source http://rubygems.org/

Now you're ready to use gem update and gem install rails

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM