This quick tip is going to help you troubleshoot when installing Ruby gems on a Windows environment. It’s a common consensus that Ruby doesn’t play well under Windows environment but Ruby as a programming language itself, do support running in Windows. The myth that Ruby doesn’t work well in Windows was mostly due to many popular gems under its platform simply isn’t designed to run under Windows environment.
Regardless of what you are trying to do with Ruby and its thousands gems, if you are getting error when installing compatible gems under Windows environment this will help you to troubleshoot.
Example Windows Failed to Install compass gem
If you are trying to run the following command, assuming you have Ruby already installed.
gem install compass
ERROR: Could not find a valid gem 'compass' (>= 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://rubygems.org/latest_specs.4.8.gz)
This is due to the OpenSSL doesn’t support v3 on Windows, and you can resolve this issue by adding an alternative gem source without the https prefix.
gem source –a http://rubygems.org/
Will add the none SSL URL to the gem source. It will prompt you if you want to add this insecure source, answer y to confirm. Now run the command again gem install
will successfully install the the gem from a none SSL source. If you are getting warning on any dependencies like below:
WARNING: Unable to pull data from ‘https://rubygems.org/’: SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://rubygems.org/latest_specs.4.8.gz)
You can update all the dependencies gems to pull from none SSL source by the follow command
gem update –system –source http://rubygems.org/
At the end all your system gems will be updated from a none secure source.
Hope this guide helped you with any issues on installing Ruby gems under Windows environment. As for all other platforms, some of the method would still be valid if the root cause are the same.
Many thanks brother! 🙂
>This is due to the OpenSSL doesn’t support v3 on Windows,
Wrong statement.
http://guides.rubygems.org/ssl-certificate-update/