简体   繁体   English

在Mac 10.6.4上应该从哪里下载Ruby和Ruby on Rails?

[英]Where specifically should I download Ruby and Ruby on Rails on Mac 10.6.4?

Where should I go to download it. 我应该去哪里下载它。 What exactly do I need. 我到底需要什么。 What should I do to install it? 我应该怎么做安装?

Both Ruby and Ruby on Rails are already installed on Snow Leopard. Snow Leopard上已经安装了Ruby和Ruby on Rails。 You can see the ruby version by running 您可以通过运行查看红宝石版本

$ ruby --version

However, Snow Leopard has a very old Rails version and a quite outdated Ruby version. 但是,Snow Leopard的Rails版本非常旧,而Ruby版本已经过时。 I suggest you to install RVM and use it to install Ruby 1.9.2 and Rails 3. 我建议您安装RVM并使用它来安装Ruby 1.9.2和Rails 3。

Here are the directions that I use: 这是我使用的指示:

1) install the apple developer tools (ie Xcode). 1)安装苹果开发人员工具(即Xcode)。

You can find XCode on the "Mac OS Install DVD" that came with your laptop. 您可以在笔记本电脑随附的“ Mac OS安装DVD”上找到XCode。 If you don't have this disk, you can download it from apple developer tools. 如果没有此磁盘,则可以从Apple开发人员工具下载该磁盘。 It is over 2 gigs, so go get a cup of coffee. 已经超过2场演出,所以去喝杯咖啡。 Why do we install this The Ruby on Rails version shipped with OS X is a production version of Ruby and does not include the ruby headers. 我们为什么要安装此版本OS X附带的Ruby on Rails版本是Ruby的生产版本,并且不包含ruby标头。 Because you will want to use a debugger, you will want to install apple developer tools. 因为您将要使用调试器,所以将要安装Apple开发人员工具。

2) install rvm 2)安装rvm

RVM allows you to have multiple versions of ruby on your system and the same time and quickly switch between them. RVM允许您同时在系统上拥有多个版本的红宝石,并可以在它们之间快速切换。 We'll use it because it provides a nice abstraction layer. 我们将使用它,因为它提供了一个不错的抽象层。

  • source for these directions: http://rvm.beginrescueend.com/rvm/install/ 这些说明的来源: http : //rvm.beginrescueend.com/rvm/install/
  • on the command line, type "bash < <( curl http://rvm.beginrescueend.com/releases/rvm-install-latest )" 在命令行上,键入“ bash <<(curl http://rvm.beginrescueend.com/releases/rvm-install-latest )”
  • Once it is finished, it will ask you to do several things. 完成后,它将要求您做几件事。
  • On my machine, I put the following line at the end of my .profile -- on a new machine you might not yet have a .profile file. 在我的机器上,我将以下行放在.profile的末尾–在新机器上,您可能还没有.profile文件。 In your terminal window, type vi .profile, 在终端窗口中,输入vi .profile,

    • to insert code type "i" 插入代码类型“ i”
    • to exit editing mode hit the escape key 要退出编辑模式,请按退出键
    • to save and quit type ":wq" 保存并退出,输入“:wq”
    • "[[ -s $HOME/.rvm/scripts/rvm ]] && source $HOME/.rvm/scripts/rvm" “ [[-s $ HOME / .rvm / scripts / rvm]] &&源$ HOME / .rvm / scripts / rvm”
  • Kill all open terminal windows 杀死所有打开的终端窗口
  • Validate that you have rvm installed properly, start a new terminal window and type "type rvm | head -n1" -- you should see "rvm is a function" 验证您是否正确安装了rvm,启动新的终端窗口并键入“ type rvm | head -n1”-您应该看到“ rvm是一个功能”

3) install ruby (feel free to pick a different version of ruby than this one) 3)安装红宝石(可以选择与此版本不同的红宝石)

from the command line type "rvm install ruby-1.8.7-p302" * From a terminal window type "rvm --default ruby-1.8.7-p302" * Type "rvm list", you should see "=> ruby-1.8.7-p302 [ x86_64 ]" 3) 从命令行键入“ rvm install ruby​​-1.8.7-p302” *从终端窗口键入“ rvm --default ruby​​-1.8.7-p302” *输入“ rvm list”,您应该看到“ => ruby​​- 1.8.7-p302 [x86_64]“ 3)

4) update ruby gem manager 4)更新Ruby宝石管理器

from the command line type "sudo gem update --system" 从命令行输入“ sudo gem update --system”

5) instal rails 5)安装导轨

"gem install rails -v 3.0.4 --no-rdoc --no-ri" “ gem安装导轨-v 3.0.4 --no-rdoc --no-ri”

6) install mongrel 6)安装杂种

In a terminal window, type "gem install mongrel" 在终端窗口中,输入“ gem install mongrel”

7) install bundler 7)安装捆绑器

from a terminal window, type "gem install bundler" 在终端窗口中,输入“ gem install bundler”

8) getting started 8)开始

You may want to read Michael Hartl's online tutorial. 您可能需要阅读Michael Hartl的在线教程。 http://ruby.railstutorial.org/ http://ruby.railstutorial.org/

You could do: (on a Terminal) 您可以这样做:(在终端上)

sudo gem update --system

Then : 然后 :

gem install rails

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

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