一 什么是 RVM
RVM 全称是 ruby version manager,它是一个命令行工具,允许您轻松地安装管理和使用多个 ruby 环境。
虽然 macOS 自带了一个ruby环境,但是那是系统自己使用的,所以权限很小,只有 system。而/Library目录是root权限,所以很多会提示无权限。
二:安装步骤
安装历史一
如果之前安装过 RVM 想要更新 则 $ rvm get stable 升级
Mac ~ % rvm get stable
Downloading https://get.rvm.io
No GPG software exists to validate rvm-installer, skipping.
curl: (35) LibreSSL SSL_connect: SSL_ERROR_SYSCALL in connection to api.github.com:443
WARN: ...the preceeding error with code 35 occurred while fetching https://api.github.com/repos/rvm/rvm/tags
Downloading https://github.com/rvm/rvm/archive/1.29.9.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.9/1.29.9.tar.gz.asc
Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.29.9/1.29.9.tar.gz.asc',
but no GPG software exists to validate it, skipping.
Upgrading the RVM installation in /Users/mac/.rvm/
RVM PATH line found in /Users/mac/.mkshrc /Users/mac/.profile /Users/mac/.bashrc /Users/mac/.zshrc.
RVM sourcing line found in /Users/mac/.profile /Users/mac/.bash_profile /Users/mac/.zlogin.
Upgrade of RVM in /Users/mac/.rvm/ is complete.
* It looks like some old stuff is laying around RVM, you can cleanup with: rvm cleanup all
Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.
👉 Donate: https://opencollective.com/rvm/donate
RVM reloaded!
mac@xiaoxinxindeMac ~ % rvm -v
rvm 1.29.9 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
mac@xiaoxinxindeMac ~ %
安装历史二
如果之前安装过 RVM 想要更新 则 $ rvm get stable 升级
Mac ~ % rvm get stable
Downloading https://get.rvm.io
Downloading https://raw.githubusercontent.com/rvm/rvm/master/binscripts/rvm-installer.asc
Verifying /Users/mac/.rvm/archives/rvm-installer.asc
gpg: 签名建立于 三 7/24 05:59:45 2019 CST
gpg: 使用 RSA 密钥 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: 完好的签名,来自于 “Piotr Kuczynski <piotr.kuczynski@gmail.com>” [未知]
gpg: 警告:此密钥未被受信任签名认证!
gpg: 没有证据表明此签名属于其声称的所有者。
主密钥指纹: 7D2B AF1C F37B 13E2 069D 6956 105B D0E7 3949 9BDB
GPG verified '/Users/mac/.rvm/archives/rvm-installer'
Downloading https://github.com/rvm/rvm/archive/1.29.10.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.10/1.29.10.tar.gz.asc
gpg: 签名建立于 四 3/26 05:58:42 2020 CST
gpg: 使用 RSA 密钥 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: 完好的签名,来自于 “Piotr Kuczynski <piotr.kuczynski@gmail.com>” [未知]
gpg: 警告:此密钥未被受信任签名认证!
gpg: 没有证据表明此签名属于其声称的所有者。
主密钥指纹: 7D2B AF1C F37B 13E2 069D 6956 105B D0E7 3949 9BDB
GPG verified '/Users/mac/.rvm/archives/rvm-1.29.10.tgz'
Upgrading the RVM installation in /Users/mac/.rvm/
RVM PATH line found in /Users/mac/.mkshrc /Users/mac/.profile /Users/mac/.bashrc /Users/mac/.zshrc.
RVM sourcing line found in /Users/mac/.profile /Users/mac/.bash_profile /Users/mac/.zlogin.
Upgrade of RVM in /Users/mac/.rvm/ is complete.
Thanks for installing RVM 🙏
Please consider donating to our open collective to help us maintain RVM.
👉 Donate: https://opencollective.com/rvm/donate
RVM reloaded!
Mac ~ % rvm -v
rvm 1.29.10 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
使用 HTTPDNS 获取 ip 后 编辑 iHost 文件
13.229.188.59 github.com
69.171.233.33 github.global.ssl.fastly.net
151.101.108.133 raw.githubusercontent.com
97.107.133.48 get.rvm.io
- 安装 Homebrew
- 安装 gpg
: $ brew install gnupg
- 安装 mpapis 公钥, 打开 https://rvm.io
gpg --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg --keyserver hkp://pgp.mit.edu --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3 7D2BAF1CF37B13E2069D6956105BD0E739499BDB
gpg: 从公钥服务器接收失败:No keyserver available
如果显示从公钥服务器接收失败则尝试下面的
gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
Mac ~ % gpg --keyserver hkp://keys.gnupg.net --recv-keys 409B6B1796C275462A1703113804BB82D39DC0E3
gpg: 密钥 3804BB82D39DC0E3:“Michal Papis (RVM signing) <mpapis@gmail.com>” 未改变
gpg: 处理的总数:1
gpg: 未改变:1
安装 RVM
\curl -sSL https://get.rvm.io | bash -s stable
For installing RVM with default Ruby and Rails in one command, run:
\curl -sSL https://get.rvm.io | bash -s stable —rails
常用命令
- 查看 rvm 版本:rvm -v // rvm 1.29.10
- 查看现在使用 RVM 管理的 Ruby 版本:which rvm
- 列出可供 RVM 使用的 Ruby 版本:rvm list
- 列出可安装的版本:rvm list known
网友评论