Trying to install Foundation after installing nodejs, ruby, and git plus bower.
I keep getting the following error and I dont know how to fix it:
Could not find a valid gem 'foundation' (>= 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)
Any ideas?
Try this (quick but insecure)
gem sources --remove https://rubygems.org/
gem sources -a http://rubygems.org/
NOTE : Downloading over HTTP will be unencrypted
If you're using RVM (highly recommended) you can run
rvm osx-ssl-certs update all
Otherwise you can follow the directions at http://guides.rubygems.org/ssl-certificate-update/ and while the update_rubygems
patch didn't do anything for me, manually installing the .pem file probably would have worked.
Without RVM the link suggests that you can try...
gem install bundler
or
gem update --system
Look at this, the issue is explained in detail:
https://gist.github.com/luislavena/f064211759ee0f806c88
Please read the background and follow the official guide from rubygems.org on how to fix this.
TL;DR:
- Download rubygems-update-2.6.7.gem (link will be stale when new version is out)
gem install --local $USER\Downloads\rubygems-update-2.6.7.gem
(Try %userprofile% instead of $USER if using Windows)
update_rubygems --no-ri --no-rdoc
gem uninstall rubygems-update -x
Taken from the reference given by Sébastien
Basicaly, you download the latest certificate and place it in $RUBYHOME/lib/ruby/2.1.0/rubygems/ssl_certs
. (Note that you might have a different version of rubygems installed than 2.1.0
, so adjust the path appropriately).
Rubygems should be using the certificate the next time you call the gem command.
You need to update your gem installation to the version 2.6.7. Try this solution here:
https://github.com/rubygems/rubygems/issues/1770
http://guides.rubygems.org/ssl-certificate-update/#installing-using-update-packages
On linux, or in a docker container the following command will solve the problem:
curl https://raw.githubusercontent.com/rubygems/rubygems/master/lib/rubygems/ssl_certs/index.rubygems.org/GlobalSignRootCA.pem > $(ruby -ropenssl -e 'puts OpenSSL::X509::DEFAULT_CERT_FILE')
The above command will fetch the CA cert that rubygems expects when connecting to its website and install it in the location that ruby expects the cert to live.
Thanks to Gabe Evans helpful blog post, for detailing a smart way of solving the problem in one line of code.
I modified Gabe's solution to use the CA cert specified on the rubygems website. Further discussion of why this problem arose can be found there.
The benefit of this solution is that it uses https to fetch the updated cert for rubygems. Since it fetches this cert from github it can work even with a SHA1 cert. It is also handy because it uses ruby, by pulling in the openssl library to place the cert where it needs to go.