Can't access RubyGems - possibly due to SSL?
Here is a quick solution:
Go to your gem file and change
source 'https://rubygems.org'
to
source 'http://rubygems.org' #remove the 's'
Check this similar question on StackOverflow for more solutions and insights into the error :)
Edit:
Based on inputs by @Anthony in the comments below, here is a more permanent solution :
Download : AddTrustExternalCARoot-2048.pem.(Note: File must have .pem as extension. Browsers like Chrome will try to save it as plain text file. Ensure you change the filename to have .pem in it after you have downloaded it.)
Now Run the following in your command prompt:
C:\>gem which rubygems
Thiw will give you a path where you need to place the above .pem
file. Navigate inside the directory to which the path points. Inside it locate ssl_certs
directory and copy the .pem file we obtained from previous step inside.
This shall do the trick!
bundle install fails with SSL certificate verification error
Update
Now that I've karma wh..err mined enough from this answer everyone should know that this should have been fixed.
re: via Ownatik again bundle install fails with SSL certificate verification error
gem update --system
My answer is still correct and left below for reference if that ends up not working for you.
Honestly the best temporary solution is to
[...] use the non-ssl version of rubygems in your gemfile as a temporary workaround.
via user Ownatik
what they mean is at the top of the Gemfile
in your rails application directory change
source 'https://rubygems.org'
to
source 'http://rubygems.org'
note that the second version is http instead of https
SSL Error When installing rubygems, Unable to pull data from 'https://rubygems.org/
For RVM & OSX users
Make sure you use latest rvm:
rvm get stable
Then you can do two things:
Update certificates:
rvm osx-ssl-certs update all
Update rubygems:
rvm rubygems latest
For non RVM users
Find path for certificate:
cert_file=$(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')
Generate certificate:
security find-certificate -a -p /Library/Keychains/System.keychain > "$cert_file"
security find-certificate -a -p /System/Library/Keychains/SystemRootCertificates.keychain >> "$cert_file"
The whole code: https://github.com/wayneeseguin/rvm/blob/master/scripts/functions/osx-ssl-certs
For non OSX users
Make sure to update package ca-certificates
. (on old systems it might not be available - do not use an old system which does not receive security updates any more)
Windows note
The Ruby Installer builds for windows are prepared by Luis Lavena and the path to certificates will be showing something like C:/Users/Luis/...
check https://github.com/oneclick/rubyinstaller/issues/249 for more details and this answer https://stackoverflow.com/a/27298259/497756 for fix.
Could not verify the SSL certificate for https://rubygems.org/
I had this problem on Mac OS X Yosemite with ruby 2.3.1.
I fixed the problem by downloading http://curl.haxx.se/ca/cacert.pem to /usr/local/etc/openssl/
and adding this line export SSL_CERT_FILE=/usr/local/etc/openssl/cacert.pem
to .bash_profile
Credit to Can't run Ruby 2.2.3 with RVM on OSX but it was hard to google the right answer, so added to this page.
Unable install gems from 'https ://rubygems.org/' after MacOS Mojave update SSL/TLS (?)
I was able to install gems. I had to recompile all rubies:
$ ram uninstall ruby-1.8.7-p374
$ rvm install ruby-1.8.7-p374 --with-gcc=clang
$ rvm use ruby-1.8.7-p374@openssl-test01 --create
$ gem install rdoc-data -v 3.12
After this I was able to install although the link to /System/openssl is still shown in rvm osx-ssl-certs status all.
Related Topics
How to Have Class.Property = X Return Something Other Than X
How to Execute a Ruby Script in Terminal
Unresolved Specs During Gem::Specification.Reset:
How to Use Rvm and Create Globally Available Gems
Find Key/Value Pairs Deep Inside a Hash Containing an Arbitrary Number of Nested Hashes and Arrays
Ruby Templates: How to Pass Variables into Inlined Erb
Fibonacci Sequence in Ruby (Recursion)
Rspec: Expect VS Expect With Block - What's the Difference
Xpath Axis, Get All Following Nodes Until
How to Test a Function With Gets.Chomp in It
Ruby: Installing Rmagick on Ubuntu
Character Encoding Issue in Rails V3/Ruby 1.9.2
What Will Give Me Something Like Ruby Readline with a Default Value