macOS Ruby版本需要升级到2.2.2以上

在安装Ruby on Rails时,发现需要Ruby版本为2.2.2或更高。通过RVM(Ruby Version Manager)进行升级,首先检查RVM安装,然后查看并选择合适的Ruby版本进行升级,确保兼容性。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

在安装 Ruby on Rails 时遇到问题,提示依赖 ruby 2.2.2 或更高的版本。

ERROR:  Error installing rails:
	activesupport requires Ruby version >= 2.2.2.

一、使用RVM也就是Ruby Version Manager,Ruby版本管理器来升级rubyRVM包含了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 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值