当前位置:首页 >> 脚本专栏

更改RubyGem安装源

WHY"htmlcode">

$ gem sources --remove https://rubygems.org/
$ gem sources -a http://ruby.taobao.org/
$ gem sources -l
*** CURRENT SOURCES ***
http://ruby.taobao.org
# 请确保只有 ruby.taobao.org
$ gem install rails

 
如果是用 Bundle (Rails 项目)

$ vi Gemfile
source 'http://ruby.taobao.org/'
gem 'rails', '3.2.12'
...

RVM 改用淘宝下载源, 提高 Ruby 安装速度

FOR MAC

$ sed -i .bak 's!ftp.ruby-lang.org/pub/ruby!ruby.taobao.org/mirrors/ruby!' $rvm_path/config/db

FOR LINUX

$ sed -i 's!ftp.ruby-lang.org/pub/ruby!ruby.taobao.org/mirrors/ruby!' $rvm_path/config/db