一、搭建环境
为了升级更快捷,搭建更方便,便于处理,需要依赖的软件包括:
rvm #Ruby Version Manager,Ruby版本管理器,包括Ruby的版本管理和Gem库管理(gemset)。
###1.1 安装rvm
$ curl -L get.rvm.io | bash -s stable
$ source ~/.profile
验证是否安装正常
rvm -v
###1.2 安装ruby
列出ruby可安装版本
rvm list known
安装一个ruby版本
rvm install 2.4
查看已安装列表
rvm list
卸载ruby版本
rvm remove 2.4
切换 ruby版本
rvm use 2.4 #切换的版本均是已安装的版本
安装时可能出现的错误
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.12/x86_64/ruby-2.4.1.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system - please wait
Installing required packages: autoconf, automake, libtool, pkg-config, coreutils, libyaml, libksba - please wait
There were package installation errors, make sure to read the log.
Try `brew tap --repair` and make sure `brew doctor` looks reasonable.
Check Homebrew requirements https://github.com/Homebrew/homebrew/wiki/Installation
Error running 'requirements_osx_brew_libs_install autoconf automake libtool pkg-config coreutils libyaml libksba',
please read /Users/zenyu/.rvm/log/1509172777_ruby-2.4.1/package_install_autoconf_automake_libtool_pkg-config_coreutils_libyaml_libksba.log
Requirements installation failed with status: 1.
运行brew tap —repair 后,再次安装ruby