在安装 Ruby on Rails 时遇到问题,提示依赖 ruby 2.2.2 或更高的版本。
ERROR: Error installing rails:
activesupport requires Ruby version >= 2.2.2.
一、使用RVM也就是Ruby Version Manager,Ruby版本管理器来升级ruby,RVM包含了Ruby的版本管理和Gem库管理(gemset)。(以下命令都在终端中进行,因为基本都是命令行 我就不上图了,终端的提示也比较清晰)
1、安装RVM$ curl -L get.rvm.io | bash -s stable
命令输出:
Downloading https://github.com/rvm/rvm/archive/1.29.2.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.29.2/1.29.2.tar.gz.asc
Found PGP signature at: 'https://github.com/rvm/rvm/releases/download/1.29.2/1.29.2.tar.gz.asc',
but no GPG software exists to validate it, skipping.
Installing RVM to /Users/aven/.rvm/
Adding rvm PATH line to /Users/aven/.profile /Users/aven/.mkshrc /Users/aven/.bashrc /Users/aven/.zshrc.
Adding rvm loading line to /Users/aven/.profile /Users/aven/.bash_profile /Users/aven/.zlogin.
Installation of RVM in /Users/aven/.rvm/ is almost complete:
* To start using RVM you need to run `source /Users/aven/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
# aven,
#
# 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
* WARNING: You have '~/.profile' file, you might want to load it,
to do that add the following line to '/Users/aven/.bash_profile':
source ~/.profile
可以看到最后有一条警告,需要执行:
source ~/.profile
主要作用应该就是更新环境变量。
2、测试是否安装成功
rvm -v
直接执行 rvm 不带参数会显示帮助信息。
<a href="https://www.bountysource.com/teams/rvm?utm_source=RVM&utm_medium=shield&utm_campaign=raised"><img src="https://api.bountysource.com/badge/team?team_id=506&style=raised" align="center"></a>
Master
<a href="https://travis-ci.org/rvm/rvm/branches"><img src="https://travis-ci.org/rvm/rvm.svg?branch=master" align="center"></a>
# What's RVM
RVM is the acronym of Ruby enVironment Manager. It manages Ruby application environments and enables switching between them.
Homepage and more info: https://rvm.io/
## Installing RVM
### Ubuntu
RVM have dedicated Ubuntu package, so please follow instructions posted here: https://github.com/rvm/ubuntu_rvm
If you need a different (newer) version of RVM, after