How do I nuke RubyGems and start again from scratch? - macos

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?

Related

Cocoapods unable to download data from ruby [duplicate]

This question already has answers here:
Cannot install any ruby gems on Mac OS - SSL_connect error
(3 answers)
Closed 4 years ago.
Im very new to Xcode and im trying to get firebase but cocoapods wont install. Whenever I type gem install cocoapods or sudo gem install cocoapods I get this...
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)
Im pretty sure I have the latest version of ruby (2.0.0), Xcode 8.2, and im running MacOS 10.11.6 El Capitan on a mid2007 IMac. Im not sure if my computer is outdated and cant download it.
I haven't found any clear answers anywhere else other than try putting sudo in front of gem so any help is appreciated. Sorry in advanced if this question has been asked or if its a very simple fix, I am very new to xcode and coding in general.
I wanted to leave this question up in case anyone else who is new wanted an easy answer. I also added this as a duplicate question to one with a more in depth answer I think.
How I fixed my problem:
I installed homebrew https://brew.sh/
Then I used homebrew to install rbenv with brew install rbenv
Once I had rbenv I downloaded 2.0.0-dev instead of 2.0.0 and used rbenv local 2.0.0-dev to set it as my main ruby version.
Then I opened a new terminal and proceeded as normal by installing cocoapods and installing a podfile into my xcode.

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

SSL certificate verify failed error when trying to install gems

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 :)

Certificate failure and Windows10 gem version 2.4.5.1

I'm new to much of this:
My problem begins at the rails new sample_app stage of the installrails.com process.
it does its thing, getting to run bundle install and errors with "Could not verify the SSL certificate for https://rubygems.org/."
I search and learn I must update certificates, as discussed here: http://guides.rubygems.org/ssl-certificate-update/
I learn at the above page that rubygems 2.4.x is broken for windows, and therefore no download exists to update my certificates.
So I try to update $ gem update --system 2.6.7 and this is what is returned:
Updating rubygems-update
ERROR: Error installing rubygems-update:
Unable to resolve dependency: user requested 'rubygems-update (= 2.6.7)'
ERROR: While executing gem ... (NoMethodError)
undefined method `version' for nil:NilClass
I keep trying to figure out how to do something so simple as uninstall my gem version 2.4.5.1 and install 2.6.7 but can't do it... my syntax?
I have also seen a workaround using these:
gem sources --remove https://rubygems.org/
gem sources -a http://rubygems.org/
But I don't understand how that helps with certificates or how it is a permanent solution! I removed the secure source, and cannot reobtain it because of the same certificate error. So now I am stuck with the http one. Thanks for your help!
Okay so I started fresh after posting the question.
I used the work around to bypass the certificate problem:
gem sources --remove https://rubygems.org/
gem sources -a http://rubygems.org/
This then allowed me to update my gem version.
gem update --system
Then I switched gem sources back:
gem sources --remove http://rubygems.org/
gem sources -a https://rubygems.org/
I ran into another problem when running rails new sample_app at the same place, bundle install. I found the fix here: Ruby on Rails cannot bundle install
my command was gem install bundler
then I was able to successfully create the sample app. Looking forward to the next problem!

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.

Resources