Completely reinstalling Ruby Rails and Gem on Mac OS X

不问归期 提交于 2019-12-11 07:23:50

问题


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.


回答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.




回答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




回答3:


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.




回答4:


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.



来源:https://stackoverflow.com/questions/8316026/completely-reinstalling-ruby-rails-and-gem-on-mac-os-x

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!