SSL certificate verify failed error when trying to install gems - ruby

Im on OSX 10.10.5 and using RVM and ruby version 2.3.1. When i run gem install <gem_name> i get the following error
Unable to download data from https://rubygems.org/ - SSL_connect
returned=1 errno=0 state=error: certificate verify failed
(https://api.rubygems.org/specs.4.8.gz)
I tried with different versions of ruby but still get the same error. When i run the following command
rvm osx-ssl-certs status all
I get:
Certificates for /etc/openssl/cert.pem: Up to date.
Certificates for /usr/local/etc/openssl/cert.pem: Up to date.
I have done rvm osx-ssl-certs update all again but still the error persists. Also trying to do gem update --system gives the same error.
The output of ruby -ropenssl -e 'p OpenSSL::OPENSSL_VERSION' is "OpenSSL 1.0.2h 3 May 2016"
Any way to fix this ?
Thank You

I had this same problem, the only way it work for me is to download the most updated rubygem from official website, then running the following command:
Download gem from rubygems
Unpack rubygem zip file into any directory
cd into the unpacked rubygem folder
Install with: ruby setup.rb (you may need admin/root privilege)
Enter sudo gem update --system (to test you have most updated rubygem)
...After last step, it responded with Latest version currently installed. Aborting yay! Hope this helps :)

Related

How do I nuke RubyGems and start again from scratch?

I've been trying to update cocoapods on my laptop this evening and I'm getting a weird RubyGems error...
With the following command...
sudo gem install cocoapods
I got the following error.
ERROR: Could not find a valid gem 'cocoapods' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect returned=1 errno=0 state=SSLv2/v3 read server hello A: tlsv1 alert protocol version (https://rubygems.org/latest_specs.4.8.gz)
Not sure where to go from here. This used to work (two weeks ago) and the only reference I found online was from 4 years ago.
I tried updating gems gem update --system but it told me I'm on the latest version.
I can list gems and uninstall them. I just can't install them?
Oh man. I managed to get it to update with sudo and now with...
sudo gem install cocoapods
I get the error...
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj
No idea what that means?!
Oh god! OK, so I followed the advice here... https://github.com/CocoaPods/CocoaPods/issues/3692
And pod init worked. But when I restarted terminal it now says pod: command not found.
How do I nuke ruby gems and start again?

Ruby Certificate Error

I am trying to install a migration tool called move to go for a CRM system called Lime but I get an error. I dont know why, the certificate says it's valid in the SSL.
This is the step by step guide that I am executing:
https://github.com/Lundalogik/move-to-go/blob/master/step-by-step.md
and this is the documentation:
https://github.com/Lundalogik/move-to-go
C:\Users\gujo>gem install move-to-go
ERROR: Could not find a valid gem 'move-to-go' (>= 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 suggestions?
This is due to Ruby SSL certificate that has changed.
You can install a newer version of RubyGem to fix the issue.
Example, on Windows:
Download https://rubygems.org/downloads/rubygems-update-2.6.7.gem and save it to C:\rubygems-update-2.6.7.gem
Open a command prompt and run the commands :
gem install --local C:\rubygems-update-2.6.7.gem
update_rubygems --no-ri --no-rdoc
gem --version and check it is 2.6.7
gem uninstall rubygems-update -x to remove the update package
Finally, retry your gem install command and the SSL error should be gone !
Source: http://guides.rubygems.org/ssl-certificate-update/#installing-using-update-packages

I am getting error while installing json by gem using Ruby

I have Downloaded Ruby 2.1.5
cmd check command: ruby -v returns result: ruby 2.1.5
Downloaded DevKit file from here DevKit-mingw64-32-4.7.2-20130224-1151-sfx.exe
Extract DevKit to path C:\Ruby\DevKit
cd C:\Ruby\DevKit
ruby dk.rb init
ruby dk.rb review
ruby dk.rb install
Up till this point, everything is okay but from now onward I am getting error.
I am passing from command
cmd : gem install json
and getting following error.
could not find a valid gem 'json'<>=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 faild(https:api.rubygem.org/specs.4.8.gz)
This is a pretty common issue with rubygems recently changing their certificate authority.
A detailed breakdown of the issue, and how to resolve it can be found here.

How to avoid gem update error in windows?

showing below error
C:\Ruby21>gem update
Updating installed gems
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
SSL_connect returned=1 errno=0 state=SSLv3 read server certificate B: certif
icate verify failed (https://api.rubygems.org/specs.4.8.gz)
C:\Ruby21>
May be blocked by windows firewall.
Here's the fix to your problem.
I only had to follow these instructions.
Installing using update packages (NEW)
Now that RubyGems 1.8.x, 2.0.x, and 2.2.x have been released, you can manually
update to those versions.
First, download the proper version of RubyGems for your installation (e.g. if running version 1.8.28, download 1.8.30).
Note: To find the version of RubyGems you're using, run gem --version in the command line.
You can find download links at GitHub under
Releases.
Now, locate rubygems-update-X.Y.Z.gem where X.Y.Z will be the matching version of RubyGems that you need to update:
Running 1.8.x: download 1.8.30
Running 2.0.x: donwload 2.0.15
Running 2.2.x: download 2.2.3
Please download the file in a directory that you can later point to (e.g. the
root of your harddrive C:\)
Now, using your Command Prompt:
C:\>gem install --local
C:\rubygems-update-1.8.30.gem
C:\>update_rubygems --no-ri --no-rdoc
After this, gem --version should report the new update version.
You can now safely uninstall rubygems-update gem:
C:\>gem uninstall rubygems-update -x
Removing update_rubygems
Successfully uninstalled rubygems-update-2.2.3
After following these instructions, I was able to run gem update --system successfully.
I didn't have to implement the following set of instructions.
I think I was running gem version 2.4.4.

Error: SASS installation for windows

am trying to install sass after installing ruby, but iam getting following error, please help me to fix this
maradhak#WW730VW7X1688 /c/softwares
$ gem -v
2.2.2
maradhak#WW730VW7X1688 /c/softwares
$ gem install sass
ERROR: Could not find a valid gem 'sass' (>= 0), here is why:
Unable to download data from https://rubygems.org/ - SSL_connect retur
ned=1 errno=0 state=SSLv3 read server certificate B: certificate verify failed (
https://rubygems.org/latest_specs.4.8.gz)
The error has something to do with being vulnerable to the Poodle SSL bug, it will not be verified for that reason. If there's a way to upgrade to a better certificate, but at the time of writing this answer, I could not find the upgraded certificate.
I used the non-SSL host instead, altough I should note that this is not the best nor a permanent solution, it lacks security.
The command used:
gem source -a http://rubygems.org/
A discussion about this subject can be found here: https://github.com/rubygems/rubygems/issues/515#issuecomment-65326585
Update: There seems to be a permanent solution now, which replaces the certificate with a proper protected one. It can be found on the following URL, an tutorial is included in that page.
https://gist.github.com/luislavena/f064211759ee0f806c88#installing-using-update-packages-new
Short answer:
gem sources -a http://rubygems.org/
Confirm than you don't really care about that specific warning, since you trust rubygems.org. Then:
gem install sass
And it works.
thanks for your suggestions, as you guys said this seems to be SSH update issue.
have solved this issue simply down graded my RUBY version from "2.1.5" to "1.8", and the gem version is "1.8.29".
then i was able to install SASS
Following worked for me:
Remove the https source temporary, run gem update --system and then switch back to https.
gem sources --remove https://rubygems.org/
gem sources --add http://rubygems.org
gem update --system
gem sources --remove http://rubygems.org
gem sources --add https://rubygems.org
Ref: https://github.com/rubygems/rubygems/issues/1736
I also encountered the same problem today。
Running gem install sass returned
ERROR: Could not find a valid gem 'sass' (>= 0), here is why:Unable to download data from https://rubygems.org/ -SSL_connect returned=1 errno=0 state=SSLv3read server certificate B: certificate verify failed(https://api.rubygems.org/specs.4.8.gz)
Then I find a way to fix it:
gem sources -a http://rubygems.org/
gem install sass
Adding http://rubygems.org/ to sources solves this.
Here is a capture of my terminal
For me it was a proxy issue. When I appended the proxy details to the gem install command it worked.
gem install sass --http-proxy=http://<yourproxy>:<port>
The first step to Rubygems(http://rubygems.org/) then download sass on(http://rubygems.org/gems/sass)
put in: npm install
You don't need to disable SSH or downgrade your ruby version, you can simply install the SASS gem manually. Here's how to do it:
On windows, first install the Ruby installer for windows.
Download the latest version of the gem from here:
https://rubygems.org/gems/sass Click the latest version, and then on
the right side of the screen (in Links section) click the "Download"
link to download the original gem file (sass-*.*.*.gem)
Now paste the downloaded gem file to the directory that ruby is
installed on: C:\Ruby22-x64\bin\sass-*.*.*.gem
In Command Prompt run the following commands:
cd C:Ruby22-x64/bin
gem install sass-*.*.*.gem1
NOTE: You may also need to call the local flag while installing the gem: gem install --local C:Ruby22-x64/bin/sass-*.*.*.gem
Install a full fledged Cygwin on your windows, the ssh support is good in it. You should be able to install it without any extra efforts, well I always do. In fact once you have Cygwin install you would hardly use the command prompt.
I'm totally new to Ruby and Sass. I didn't want to risk security and I'm on a Windows machine. I had already installed latest ruby, but kept getting the same error message as the OP when trying to run gem install sass at the command prompt.
Here's what solved the problem for me.
Go to: https://rubygems.org/pages/download and follow the instructions on the page starting here (for manual installation):
If you don't have any RubyGems installed, there is still the pre-gem approach to getting software, doing it manually:
Download from above (URL above)
Unpack/unzip into a directory and cd there (into the directory you unzipped it)
Install with: ruby setup.rb (at the command line type that command. You may need admin/root privilege)
After I installed ruby gems, I opened Ruby command prompt (using Start Command Prompt with Ruby from the start menu) and ran the command gem install sass and it worked:
C:\Users\chris>gem install sass
Fetching: sass-3.4.22.gem (100%)
Successfully installed sass-3.4.22
Parsing documentation for sass-3.4.22
Installing ri documentation for sass-3.4.22
Done installing documentation for sass after 36 seconds
1 gem installed
Wanted to detail it as much as possible for other newbies like me. Hope this helps someone.
Changing from http to https makes your computer vulnerable to hackers
I explain some solutions in my answer here: https://stackoverflow.com/a/40075753/845413
If you found this error by searching and are using RVM on OSX just run.
rvm osx-ssl-certs update all
Bundler outlines a few other solutions in their troubleshooting guide for this error: http://bundler.io/v1.16/guides/rubygems_tls_ssl_troubleshooting_guide.html#troubleshooting-certificate-errors
and include...
gem install bundler
gem update --system
Finally, you can simply reinstall RVM or rubygems manually.
Manually install Ruby gems: https://rubygems.org/pages/download
Manually install RVM (recommended): http://rvm.io/

Resources