When I run bundle install
for my Rails 3 project on Centos 5.5 it fails with an error:
Gem::RemoteFetcher::FetchError: SSL_connect returned=1 errno=0 state=SSLv3
read server certificate B: certificate verify failed
(https://bb-m.rubygems.org/gems/multi_json-1.3.2.gem)
An error occured while installing multi_json (1.3.2), and Bundler cannot continue.
Make sure that `gem install multi_json -v '1.3.2'` succeeds before bundling.
When I try to install the gem manually (by gem install multi_json -v '1.3.2'
) it works. The same problem occurs with several other gems. I use RVM (1.12.3), ruby 1.9.2, bundler 1.1.3.
How to fix it?
The reason is old rubygems. You need to update system part using non ssl source first:
gem update --system --source http://rubygems.org/
(temporarily updating system part using non-ssl connection).Now you're ready to use
gem update
.If you're on a mac and use a recent version of RVM (~1.20), the following command worked for me.
This has been fixed
http://guides.rubygems.org/ssl-certificate-update/
Now that RubyGems 2.6.x has been released, you can manually update to this version.
Download https://rubygems.org/downloads/rubygems-update-2.6.7.gem
Please download the file in a directory that you can later point to (eg. the root of your harddrive C:)
Now, using your Command Prompt:
After this, gem --version should report the new update version.
You can now safely uninstall rubygems-update gem:
The only thing that worked for me on legacy windows system and ruby 1.9 version is downloading cacert file from http://guides.rubygems.org/ssl-certificate-update/
And then running below command before running bundle install
The real solution to this problem, if you are using RVM:
gem update --system
rvm osx-ssl-certs update all
Hat tip to this tip on the RailsApps project!
You can download a list of CA certificates from curl's website at http://curl.haxx.se/ca/cacert.pem
Then set the SSL_CERT_FILE environment variable to tell Ruby to use it. For example, in Linux:
(Reference: https://gist.github.com/fnichol/867550)