在 Mac 中安装 Ruby 需要先安装好 RVM
RVM 是一个便捷的多版本 Ruby 环境的管理和切换工具 官网:https://rvm.io/
在终端控制台输入命令行:
$ curl -sSL https://get.rvm.io | bash -s stable // 之后按回车键
截止到目前 最新的版本是 rvm 1.29.10
如下所示:
:~ Mac $ 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.
Installing RVM to /Users/admin/.rvm/
Adding rvm PATH line to /Users/admin/.profile /Users/admin/.mkshrc /Users/admin/.bashrc /Users/admin/.zshrc.
Adding rvm loading line to /Users/admin/.profile /Users/admin/.bash_profile /Users/admin/.zlogin.
Installation of RVM in /Users/admin/.rvm/ is almost complete:
* To start using RVM you need to run `source /Users/admin/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
# admin,
#
# 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
等待一两分钟 成功安装好 RVM
1.2 然后 载入 RVM 环境
$ source ~/.rvm/scripts/rvm
1.3 修改 RVM 下载 Ruby 的源 到 Ruby China 的镜像 !
记住这个镜像 是 ruby-china.com 不是其他的
$ echo "ruby_url=https://cache.ruby-china.com/pub/ruby" > ~/.rvm/user/db
1.3.1 检查一下是否安装正确
$ rvm -v
// 如下所示:
Mac :~ admin $ source ~/.rvm/scripts/rvm
Mac :~ admin $ echo