一 什么是 RVM
RVM 全称是 ruby version manager,它是一个命令行工具,
允许您轻松地安装管理和使用多个 ruby 环境 。
虽然 macOS 自带了一个ruby环境,但是那是系统自己使用的,
所以权限很小,只有 system 。
而 /Library 目录是 root 权限,所以很多会提示无权限。
二:安装步骤
安装历史一
如果之前安装过 RVM 想要更新 则 $ rvm get stable 升级
Pro ~ % rvm get stable
Downloading https://get.rvm.io
No GPG software exists to validate rvm-installer, skipping.
Downloading https://github.com/rvm/rvm/archive/1.29.12.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc
Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.29.12/1.29.12.tar.gz.asc',
but no GPG software exists to validate it, skipping.
Upgrading the RVM installation in /Users/shiran/.rvm/
RVM PATH line found in /Users/shiran/.mkshrc /Users/shiran/.profile /Users/shiran/.bashrc /Users/shiran/.zshrc.
RVM sourcing line found in /Users/shiran/.profile /Users/shiran/.bash_profile /Users/shiran/.zlogin.
Upgrade of RVM in /Users/shiran/.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!
Pro ~ % rvm -v
rvm 1.29.12 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io]
Pro ~ %
使用 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.12
- 查看现在使用 RVM 管理的 Ruby 版本:which rvm
- 列出可供 RVM 使用的 Ruby 版本:rvm list
- 列出可安装的版本:rvm list known