Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I completely uninstall rails, ruby and rubygems?

Tags:

My system is F'd. How do I completely uninstall rails, ruby and rubygems?

any suggestions on where to go to reinstall from scratch? Best practices? I'd like to get back to 3.0 beta

Thanks!

like image 550
JZ. Avatar asked Mar 12 '10 02:03

JZ.


People also ask

How do I uninstall Ruby on Rails?

There are two ways to remove rubies from RVM: rvm remove removes Ruby and cleans up most of the install. rvm uninstall removes only Ruby (leaves anything else)


2 Answers

You can use gem uninstall to delete all gems as follows:

gem list --no-version | xargs gem uninstall 

If you want to keep eg. the gem rake:

gem list --no-version | grep -v "rake" | xargs gem uninstall 

To delete only the old versions, you can run gem clean.


Also, it is possible to write all gems in a list:

gem list --no-version > gem_list.txt  

and define these you want to delete:

cat gem_list.txt | xargs gem uninstall  

or install:

cat gem_list.txt | xargs gem install 

(eventually you have to put a sudo in front of a gem command. On windows use an unix console enviroment like msysGit)

like image 72
raptor Avatar answered Oct 07 '22 00:10

raptor


I suggest you to simply uninstall all Gems using gem uninstall [name_of_gem], then use RVM to install a new Ruby version and make it the default one.

RVM also makes incredibly easy to remove a Ruby version and all its data since it installs everything in a folder within your home directory.

like image 22
Simone Carletti Avatar answered Oct 07 '22 01:10

Simone Carletti