简介
RVM 是一个命令行工具,可以提供一个便捷的多版本 Ruby 环境的管理和切换。
安装
首先导入秘钥
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
然后安装
\curl -sSL https://get.rvm.io | bash -s stable
输出
Downloading https://github.com/rvm/rvm/archive/1.29.1.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.1/1.29.1.tar.gz.asc
Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.29.1/1.29.1.tar.gz.asc',
but no GPG software exists to validate it, skipping.
Creating group 'rvm'
Installing RVM to /usr/local/rvm/
Installation of RVM in /usr/local/rvm/ is almost complete:
* First you need to add all users that will be using rvm to 'rvm' group,
and logout - login again, anyone using rvm will be operating with `umask u=rwx,g=rwx,o=rx`.
* To start using RVM you need to run `source /etc/profile.d/rvm.sh`
in all your open shell windows, in rare cases you need to reopen all shell windows.
# Administrator,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
In case of problems: https://rvm.io/help and https://twitter.com/rvm_io
这样就表示安装成功了
让环境变量立即生效
source /etc/profile.d/rvm.sh
简单的使用命令
-
rvm list known
列出已知可以使用的ruby版本 -
rvm install 2.4
安装ruby2.4版本 -
rvm use 2.4
切换ruby版本 -
rvm use 2.4 --default
设置ruby默认版本 -
rvm list
列出ruby已安装版本 -
rvm remove 2.4
删除一个ruby版本