先安装rvm
curl -L https://get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
安装必须的东西
rvm requirements
看看装哪个ruby
rvm list known
2.1.3貌似最新
rvm install ruby-2.1.3
设置默认
rvm use ruby-2.1.3 --default
如果看到
RVM is not a function, selecting rubies with ‘rvm use ...‘ will not work. You need to change your terminal emulator preferences to allow login shell. Sometimes it is required to use `/bin/bash --login` as the command. Please visit https://rvm.io/integration/gnome-terminal/ for an example.
则在.bashrc添加
source ~/.rvm/scripts/rvm
重启bash
安装rubygems,不过理论上应该已经包含在ruby里面了
rvm rubygems current
修改gem的源到淘宝
先看看原来的
gem sources -l
删除
gem sources --remove https://rubygems.org/ gem sources -a http://ruby.taobao.org/
下面直接安装rails
gem install rails -V
补充个别人写的换源的工具
gem install chsource
用法:
rails new helloWorld --skip-bundle cd helloWorld chsource taobao bundle install
时间: 2024-11-05 14:49:03