Set path

add $(ruby -e 'puts Gem.user_dir')/bin: to your $PATH. You can do this by adding the following line to ~/.bashrc:

PATH="$(ruby -e 'puts Gem.user_dir')/bin:$PATH"

Bundler install to the path

By default, Bundler installs gems system-wide, which is contrary to the behaviour of gem itself on Arch. To correct this, add the following to your ~/.bashrc:

export GEM_HOME=$(ruby -e 'puts Gem.user_dir')

from wiki.archlinux.org

Modify gem sources

Gem

gem source -r https://rubygems.org/
gem source -a http://mirrors.aliyun.com/rubygems/

Using bundler and Gemfile

source 'http://mirrors.aliyun.com/rubygems/'
gem 'rails', '4.0.2'

from http://mirrors.aliyun.com/help/rubygems