简体   繁体   中英

How to move or uninstall gems from default System Ruby folder to RVM?

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?!

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM