注意:不能以root来跑linux
先安装rvmshell
curl -sSL https://rvm.io/mpapis.asc | gpg --import -; curl -L get.rvm.io | bash -s stable
source ~/.rvm/scripts/rvm
修改rvm的安装源为淘宝,提升安装速度(如今都用https)api
macruby
sed -i .bak -E 's!https?://cache.ruby-lang.org/pub/ruby!https://ruby.taobao.org/mirrors/ruby!' $rvm_path/config/db
linuxbash
sed -i -E 's!https?://cache.ruby-lang.org/pub/ruby!https://ruby.taobao.org/mirrors/ruby!' $rvm_path/config/db
安装必须的东西curl
rvm requirements
看看装哪一个rubyide
rvm list known
2.1.3貌似最新ui
rvm install ruby-
设置默认url
rvm use ruby-2.3.0 --default
若是看到spa
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
修改gem的源到淘宝
gem sources --add https://ruby.taobao.org/ --remove https://rubygems.org/
下面直接安装rails
gem install rails --no-doc -V
修改默认源,命令行中运行:
bundle config mirror.https://rubygems.org https://ruby.taobao.org
用法:
rails new helloWorld --skip-bundle cd helloWorld bundle install