Installing ruby gems on Windows
Posted by jpluimers on 2017/11/06
Steps:
- Install the Ruby Installer from rubyinstaller.org/downloads
- Add the directory where Ruby got installed to the user PATH (using
"%windir%\System32\rundll32.exe" sysdm.cpl,EditEnvironmentVariables
) in my caseC:\Ruby23\bin
as I installed Ruby 2.3.1 - Install the CA certificates:
- Download https://curl.haxx.se/ca/cacert.pem to the Ruby directory (
C:\Ruby32
)- Note this used to be at http://curl.haxx.se/ca/cacert.pem but serving that over http instead of https does not much sense when you want to secure your connections.
- Add the environment variable
SSL_CERT_FILE
with valueC:\Ruby23\cacert.pem
(again using"%windir%\System32\rundll32.exe" sysdm.cpl,EditEnvironmentVariables
).
- Download https://curl.haxx.se/ca/cacert.pem to the Ruby directory (
If you forget step 3, then you get errors like this:
C:\Users\jeroenp>gem install gist ERROR: Could not find a valid gem 'gist' (>= 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/specs.4.8.gz) C:\Users\jeroenp>gem update --system ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError) SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (https://api.rubygems.org/specs.4.8.gz)
–jeroen
References
Leave a Reply