0

I have so many issues trying to update from Rails 3.2 to Rails 4.1 following the guide that I decided to uninstall Ruby, Rails and RVM (with all its gems) and start over.

RVM and Ruby Gone. $ rvm remove

But still have a bunch of GEMS that I previously installed.

$gem list 

As suggested on this answer, to remove all gems do:

$for i in `gem list --no-versions`; do gem uninstall -aIx $i; done

But I bump again on the error:

ERROR:  While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /Library/Ruby/Gems/2.0.0 directory

This is so frustrating! Using sudo does not make the fix either.

Even if I try to uninstall one by one, the system wont let me:

$rails uninstall

Could not find gem 'pg (~> 0.17.1) ruby' in the gems available on this machine.
Run `bundle install` to install missing gems.

Why do I need another Gem to uninstall a Gem?!

Lut
  • 1,363
  • 1
  • 14
  • 30
  • if you start using rvm these gems installed under `/library/` mean nothing - don't worry about cleaning up stuff you're not using at the moment. IMO it's a waste of time to try and save a few mb of space. – Anthony Nov 12 '14 at 02:04

1 Answers1

-1

Try

for i in `gem list --no-versions`; do sudo gem uninstall -aIx $i; done

This SO question has some ideas: getting rid of ruby gems that won't die

The answer to this SO question has step by step instructions to set it up properly: Removing Gems errors

Community
  • 1
  • 1
B Seven
  • 44,484
  • 66
  • 240
  • 385