rbenv配置

git clone https://github.com/rbenv/rbenv.git ~/.rbenv

# 用来编译安装 ruby
git clone git://github.com/sstephenson/ruby-build.git ~/.rbenv/plugins/ruby-build

# 通过 rbenv update 命令来更新 rbenv 以及所有插件, 推荐
git clone git://github.com/rkh/rbenv-update.git ~/.rbenv/plugins/rbenv-update

# 使用 Ruby China 的镜像安装 Ruby, 国内用户推荐
git clone git://github.com/AndorChen/rbenv-china-mirror.git ~/.rbenv/plugins/rbenv-china-mirror

vim ~/.profile

export PATH="$HOME/.rbenv/bin:$PATH"
eval "$(rbenv init -)"

安装

rbenv install --list
rbenv install 2.5.0
rbenv global 2.5.0

设置gem和bundler的镜像

gem sources --add https://gems.ruby-china.com/ --remove https://rubygems.org/
bundle config mirror.https://rubygems.org https://gems.ruby-china.com
原文地址:https://www.cnblogs.com/ziyouchutuwenwu/p/4016202.html