rvm: certificate verify failed when installing Rails - ruby-on-rails

For the first time, I am trying ruby-2.3.0. I installed it from rvm. After installation, I try to install Rails:
$ rvm-prompt
ruby-2.3.0#mygemset
$ rvm osx-ssl-certs update all
Updating certificates for /etc/openssl/cert.pem: Updating certificates in '/etc/openssl/cert.pem'.
Updated.
Updating certificates for /usr/local/etc/openssl/cert.pem: Already up to date.
$ rvm rubygems latest
Installed rubygems 2.5.1 is newer than 2.4.8 provided with installed ruby, skipping installation, use --force to force installation.
$ gem install rails
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)
Why am I receiving the error certificate verify failed? When I navigate to the link https://api.rubygems.org/specs.4.8.gz on the browser, it downloads without problem.

Have a look here https://gist.github.com/luislavena/f064211759ee0f806c88 (see also Issue #1050 on the rubygems gem repo itself: https://github.com/rubygems/rubygems/issues/1050 if you want some great bedtime reading )
The gist (no pun intended) is that RubyGems had to update their SSL Certificate in a manner which was not deployable via rubygems itself.
You will need to do a 1 time manual installation / update of rubygems

Related

Cannot access rubygems.org

OS: Mac Catalina 15.5.5
Ruby: 2.7.1
Rails: 6.0.2.2
I was trying to uninstall the MySQL Gem and re-install it:
gem uninstall mysql2
Response:
Successfully uninstalled mysql2-0.5.3
brew upgrade openssl
Response:
openssl 1.1.1g already installed
gem install mysql2 -v 0.5.3 -- --with-opt-dir="$(brew --prefix openssl)"
Response:
ERROR: Could not find a valid gem 'mysql2' (= 0.5.3), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect SYSCALL returned=5 errno=0 state=SSLv3/TLS write client hello (https://rubygems.org/specs.4.8.gz)
This is not just for the MySQL gem. I tried creating a new Rails app, and when it tries to do the bundle, I get the same error about nor being able to access rubygems.org
Any ideas?
Solution:
Turns out it's a problem with the Kaspersky Internet Protection product. Out of the blue, it updated and decided to start blocking https connections. I've had so many problems with this product and regret having it installed, but don't think I can be without malware protection.

mac os - Gem giving Connection Reset while downloading Rails Errno::ECONNRESET: Connection reset by peer - SSL_connect

Ruby version is 2.5.1 and gem version is 2.7.7 both updated today. OpenSSL is 1.0.2 also updated today.
When i run
gem install rails -v 5.2.0
I get the following error:
ERROR: Could not find a valid gem 'rails' (= 5.2.0), here is why:
Unable to download data from https://rubygems.org/ - Errno::ECONNRESET: Connection reset by peer - SSL_connect (https://api.rubygems.org/specs.4.8.gz)
I have checked all GitHub issues and none of them had a solution. I added certificates to keychain and to the openSSL folder and nothing has seemed to work. Any ideas?
I have also checked my router and computer firewalls
Have a look at this question and try:
$ rvm -v
# rvm 1.19.1 (stable)
$ rvm osx-ssl-certs status all
# Certificates for...
$ rvm osx-ssl-certs update all
# Updating certificates...

ruby install gems - SSL connect returned certificate verify failed

I am working on a rails project. I have been working with rails for a while, and use an old MacBook Pro (2012) that has seen ruby/rails development since 2014. In that time, I have both RVM, RBENV, rails versions from 3.2 to 5.1.0, ruby versions from 2.0.0 to 2.2.3 on my machine.
Recently, I have been able to get around the error
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)
with installing gems via http and using source 'http://rubygems.org' in my gemfiles.
However, I would like to finally get rid of this issue. I have taken steps to improve this issue doing the following:
following this guide https://gist.github.com/luislavena/f064211759ee0f806c88
which lead to this link https://guides.rubygems.org/ssl-certificate-update/#installing-using-update-packages
which lead to this link https://bundler.io/v1.16/guides/rubygems_tls_ssl_troubleshooting_guide.html#troubleshooting-certificate-errors
The steps I have currently taken were to do the following:
brew update
brew install openssl-osx-ca
brew tap raggi/ale
brew upgrade openssl
However, the result of running gem update --system returned the same error
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)
The #3 solution, suggested using rvm implode, forcing brew uninstall openssl --force and starting over. I am very hesitant to do this, because I use rails in my day job and I don't want to show up (i use my machine) with a machine that cannot even turn on a rails server.
Has anyone had to perform something similar? Any actionable steps I could take to fix this SSL issue for once?
Try this manual install instruction https://github.com/rubygems/rubygems/blob/master/UPGRADING.rdoc#manual-install
OR
Download latest rubygem package https://rubygems.org/gems/rubygems-update-2.7.7.gem
Then install it
gem install rubygems-update-2.7.7.gem
This worked for me and for my colleagues.

Couldn't install rails in windows 8.1

I had install ruby -version 2.2.4p230 but unable to install rails by using gem install rails. After writing this line in CMD the error saying 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=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/latest_specs.4.8.gz)
I had searched a lot about this but didn't get anything useful for me. Please do a help for installing the rails.
Exact same error. Another poster suggested this link. http://guides.rubygems.org/ssl-certificate-update/ but it didn't work for me.
ruby -v
ruby 2.2.5p319
gem --version
2.4.5.1
gem install rails
Error: could not find a valid gem 'rails' <>=0>, here is why: Unable to download data from links removed not enough rep to post* This page suggests a manual certificate fix which I will try next http://guides.rubygems.org/ssl-certificate-update/#background I am thinking the pem file is not located correctly.

SSL Error When installing rubygems, unable to install rails gem in windows 10

I am trying to install rails in windows 10. When I attempt to install rails in my gemset, I get the following issue:
C:\>gem install rails
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=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/latest_specs.4.8.gz)
Currently using ruby version.
C:\>ruby -v
ruby 2.3.1p112 (2016-04-26 revision 54768) [i386-mingw32]
Gem Vesrion.
C:\>gem --version
2.2.3
how can I fix these issue help me out from this.
now I got solution for this issue, using this link http://guides.rubygems.org/ssl-certificate-update/#manual-solution-to-ssl-issue
we need to add GlobalSignRootCA.pem this certificate in ssl_certs folder insted of AddTrustExternalCARoot-2048.pem
go through that above link.
Your problem is most likely outdated SSL certificates included in installation.
This might help: https://gist.github.com/luislavena/f064211759ee0f806c88

Resources