简体   繁体   English

在Mac OS X上完全重新安装Ruby Rails和Gem

[英]Completely reinstalling Ruby Rails and Gem on Mac OS X

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. 我最近开始自学Ruby on Rails,除了我想要完全重新安装Ruby,Rails和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. 我想我有时会有点太兴奋了,删除/修改了一些我不应该拥有的文件或文件夹,所以我只想让系统恢复到原始状态,以便我可以重新安装必要的Ruby,Rails和Gem位。

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. 我已经读过一些地方,可以安装名为rvm的东西来执行此操作,但是现在我只想使系统尽可能简单,以使我的理解能跟上。

Any help would be appreciated. 任何帮助,将不胜感激。

Many thanks. 非常感谢。

If you are on Max OSX 10.5 and up, Ruby and RubyGems is installed with Developer Tools . 如果您使用的是Max OSX 10.5及更高版本,则Ruby和RubyGems随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 . 之后,如果您想使用RVM,请按照此处的说明进行操作 There are also some OSX specific options you should go over as well. 您还应该查看一些OSX特定选项

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:

gem uninstall GemName

... until gem list doesn't show any installed gems. ...直到gem list不显示任何已安装的宝石。 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. 我强烈建议安装RVM,因为它可以帮助您避免将来遇到相同的情况。 With RVM you can create "gemsets" to keep the gems for each project separate from other projects. 使用RVM,您可以创建“宝石集”以将每个项目的宝石与其他项目分开。 With RVM you can also install different versions of Ruby, such as the newer Ruby 1.9.2 使用RVM,您还可以安装不同版本的Ruby,例如较新的Ruby 1.9.2

Check it out! 看看这个! It's really not difficult to install 这真的不难安装

http://beginrescueend.com/ http://beginrescueend.com/

Check these RailsCasts: 检查这些RailsCasts:

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

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

You could follow the instructions on the RoR site - the download page also includes instructions. 您可以按照RoR站点上的说明进行操作 - 下载页面也包含说明。 Another option is this one click installer from the Ruby OS X project on SourceForge. 另一种选择是从SourceForge上的Ruby OS X项目中单击安装程序

If you have a TimeMachine backup available, you could also choose to restore your deleted files instead of reinstalling. 如果有可用的TimeMachine备份,则还可以选择还原已删除的文件而不是重新安装。

The simplest way is to use rvm to do this. 最简单的方法是使用rvm执行此操作。 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. 使用操作系统或MacPorts / Homebrew提供的Ruby是一种很好的方法,但它不能扩展。 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. 从长远来看,最好使用rvm,因为它更容易保持最新,安装不同版本的Ruby以及在来回切换时痛苦最小。

Plus, if you really get sideways you can always rvm implode and start over, which when combined with bundler will make life pretty easy. 另外,如果你真的侧身可以随时rvm implode ,并开始了,当它与组合bundler将使生活很容易。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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