3

I've recently started teaching myself Ruby on Rails, and it's all going well except I'm looking to completely reinstall Ruby, Rails and Gem.

I think I got a bit too excited at some point and deleted/modified some files or folders I shouldn't have, so I just want to get my system back to its original state so that I can reinstall the necessary Ruby, Rails and Gem bits.

I've read in places that I can install something called rvm to do this, but right now I just want to keep my system as simple as possible so that my understanding can keep up.

Any help would be appreciated.

Many thanks.

howardrocks
  • 343
  • 1
  • 7
  • 17
  • How did you install Ruby Gems to begin with? Was it through MacPorts? Or the Ruby Installer? RVM is a tool to help you manage your Ruby installations but you want to install it after you remove your old version of Ruby. – Devin M Nov 29 '11 at 18:53
  • I followed the instructions on Ruby on Rails. It was all fine but I fiddled a little too much and need to reset it - I see lots of people mentioning rvm, but I want to reset it COMPLETELY before I install anything else. – howardrocks Nov 29 '11 at 19:56

4 Answers4

2

You list all the gems which are installed in your user account, with:

gem list

You can then delete any of the gems, by doing this:

gem uninstall GemName

... until gem list doesn't show any installed gems. After that, everything should be as good as new.


I would highly recommend to install RVM, because it will help you not to get into the same situation in the future. With RVM you can create "gemsets" to keep the gems for each project separate from other projects. With RVM you can also install different versions of Ruby, such as the newer Ruby 1.9.2

Check it out! It's really not difficult to install

http://beginrescueend.com/

Check these RailsCasts:

http://railscasts.com/episodes/200-rails-3-beta-and-rvm

http://railscasts.com/episodes/201-bundler

Tilo
  • 33,354
  • 5
  • 79
  • 106
  • When I type gem list I get the following: Invalid gemspec in [/Library/Ruby/Gems/1.8/specifications/coffee-script-source-1.1.3.gemspec]: invalid date format in specification: "2011-11-08 00:00:00.000000000Z" Invalid gemspec in [/Library/Ruby/Gems/1.8/specifications/jquery-rails-1.0.18.gemspec]: invalid date format in specification: "2011-11-18 00:00:00.000000000Z" Invalid gemspec in [/Library/Ruby/Gems/1.8/specifications/jquery-rails-1.0.19.gemspec]: invalid date format...... etc There's a few of these, any suggestions? (Underneath it eventually displays some of the gems still working.) – howardrocks Nov 29 '11 at 19:59
  • that has nothing to do with what I wrote in my answer -- it's a side-effect of the latest version of rubygems which you have installed – Tilo Nov 30 '11 at 01:40
  • It has everything to do with what you put at the top ("gem list" and "gem uninstall GemName"). I want to uninstall defective items before layering it over with something... any ideas? – howardrocks Nov 30 '11 at 09:59
  • please re-read my comment... you get the error message because you installed a version of rubygem "gems" which causes this. Unfortunately the lastest version (1.8.11) is causing this. You can try to do `gem update --system` to get rid of it and upgrade to a newer version, but currently there is no newer version available. – Tilo Dec 01 '11 at 04:47
1

If you are on Max OSX 10.5 and up, Ruby and RubyGems is installed with Developer Tools.

On older versions you could uninstall by running this command:

$ sudo perl /Developer/Tools/uninstall-devtools.pl

Then you just need to reboot your computer and install Developer Tools again. After that if you want to use RVM follow the instructions here. There are also some OSX specific options you should go over as well.

Devin M
  • 9,636
  • 2
  • 33
  • 46
0

You could follow the instructions on the RoR site - the download page also includes instructions. Another option is this one click installer from the Ruby OS X project on SourceForge.

If you have a TimeMachine backup available, you could also choose to restore your deleted files instead of reinstalling.

JW8
  • 1,496
  • 5
  • 21
  • 36
  • The RoR site doesn't show any uninstalling tips unfortunately. And TimeMachine is a good point... but unfortunate that my hard drive stopped working last week :( – howardrocks Nov 29 '11 at 20:04
0

The simplest way is to use rvm to do this. The advantage to this is that everything's installed in a manner that's specifically isolated from the system.

Using the OS or MacPorts/Homebrew provided Ruby is a great way to get going, but it doesn't scale. For the long-haul, it's best to use rvm because it is easier to stay up to date, to install different versions of Ruby, and to switch back and forth with a minimum of pain.

Plus, if you really get sideways you can always rvm implode and start over, which when combined with bundler will make life pretty easy.

tadman
  • 208,517
  • 23
  • 234
  • 262
  • Before I install rvm, or anything else for that matter I need to completely reset everything I have at the moment. – howardrocks Nov 29 '11 at 19:57