[Ruby on Rails] Setup Enviroment

本文详细介绍了如何在本地环境中安装Ruby及Rails的过程。首先通过RVM安装Ruby,并选择合适的版本,然后安装RubyGem包管理器,最后完成Rails的安装。文章还提供了遇到常见错误时的解决方案。

There are three steps.

1. Install Ruby. 

It will be easier by using RVM. RVM is a ruby version manager.

1.1 Install RVM: https://rvm.io/rvm/install/

  Install RVM with ruby:

$ \curl -L https://get.rvm.io | bash -s stable --ruby  (By the way, curl is A command line tool for getting or sending files using URL syntax.)

1.2 Install ruby:

$ rvm install 1.9.3 (1.9.3 is the latest version of ruby)

1.3 Then do :  

$ rvm list

 You will see a list of ruby.

 do: 

$ rvm --default use 1.9.3  (the version num depends on which version you installed)

error1 happens here : RVM is not a function, selecting rubies with 'rvm use ...' will not work.
  Solutions For error1: http://stackoverflow.com/questions/9336596/rvm-installation-not-working-rvm-is-not-a-function
error2 happens here : Gemset '' does not exist, 'rvm gemset create ' first, or append '--create'.
  Solutions For error2: rvm use 1.9.3 --create (it creates the gemset if not present, seems like the global gemset somehow got deleted)

1.4 do:  

$ ruby -v

 You will see expected ruby version. 

2. Install Gem: RubyGem is the standard Ruby Package Manager. 

 do: $ require 'rubygems'

 but you don't need to do this in Ruby 1.9 or higher, it's already included.

3. Install Rails

 do:

$ sudo gem install rails
errors happen here:

ERROR: Error installing rails:
ERROR: Failed to build gem native extension.

just:

$ gem install rails

 

another thing: need to install "Common Line Tools" in XCode->Component

important thing: $ bundle install

 

 

 

 






转载于:https://www.cnblogs.com/mutelife/archive/2012/10/21/2732818.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值