macOS Ruby版本需要升级到2.2.2以上
在安装 Ruby on Rails 时遇到问题,提示依赖 ruby 2.2.2 或更高的版本。
ERROR: Error installing rails: activesupport requires Ruby version >= 2.2.2.
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px '.PingFang SC'; color: #454545}
span.s1 {font: 12.0px 'Helvetica Neue'}
一、使用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 installing base version of RVM check the [Upgrading](#upgrading) section below.
### Any other operating system
Make sure you have following required packages installed:
* `curl`
And then run:
`\curl -sSL https://get.rvm.io | bash -s stable`
### Additional installation options
Additional installation options and details about the installation process are described here: https://rvm.io/rvm/install
## Upgrading RVM
You can upgrade RVM any time by running:
`rvm get VERSION`
Where `VERSION` should be replaced by one of the following values:
* `stable` - latest stable RVM (good for servers)
* `master` - latest RVM (might not be stable)
* `branch /path/branch` - branched version of RVM (for testing new features or bug fixes)
Additional upgrading options are described here: https://rvm.io/rvm/upgrading
## Basic RVM usage
Basic RVM usage scenarios include installing and switching between different ruby versions.
### Installing ruby
To install ruby you have to call `rvm install INTERPRETER[-VERSION] OPTIONS`
When no version specified, RVM will install latest stable version or selected interpreter. If you omit to specify interpreter, RVM will assume
that you wanted to install MRI ruby. Following examples would have exactly the same effect:
```
rvm install ruby-2.3.1
rvm install ruby-2.3
rvm install 2.3.1
rvm install 2.3
```
Passing additional `--default` option makes selected ruby your default.
We currently supported following ruby interpreters:
* `ruby` - MRI ruby (The Gold Standard)
* `ironruby` - a .NET ruby
* `jruby` - Java implementation of the ruby
* `macruby` - implementation of ruby 1.9 directly on top of macOS core technologies
* `maglev` - 64-bit implementation on top of VMware's GemStone
* `mruby` - lightweight ruby
* `opal` - ruby to JavaScript compiler
* `rbx` - Rubinius - a next generation virtual machine VM for ruby
* `topaz` - high performance ruby, written in RPython
Historical interpreters which you can still install with RVM, but are not anymore developed and supported by their authors:
* `ree` - Ruby Enterprise Edition - MRI Ruby with several custom patches for performance, stability, and memory
### Switching between ruby versions
To switch between ruby versions you should call
`rvm use INTERPRETER[-VERSION]`
Same rules and options apply as for `install` command with two special _interpreters_.
* `default` - [default](https://rvm.io/rubies/default/) ruby (or the system ruby if a default hasn't been set)
* `system` - system ruby (state before RVM was installed)
Additionally you might want list your preferred ruby version in `.ruby-version` file stored in your project folder. This would cause automatic switch to selected ruby whenever you enter the folder.
### Other RVM commands
RVM comes bundled with many different tools for managing your ruby environment. More detailed information about every commands listed below can be read after executing `rvm help COMMAND` or browsing documentation on RVM homepage https://rvm.io/.
#### Installation
* `implode` - removes the rvm installation completely. This means everything in `$rvm_path` (`~/.rvm` || `/usr/local/rvm`). This does not touch your profiles. However, this means that you must manually clean up your profiles and remove the lines which source RVM
* `install` - [install](https://rvm.io/rubies/installing/) one or many ruby versions
* `list` - show currently installed rubies, interactive output - https://rvm.io/rubies/list/
* `mount` - install rubies from external locations
* `patchset` - tools related to managing ruby patchsets
* `pkg` - install a dependency package `{readline,iconv,zlib,openssl}` - https://rvm.io/packages/
* `reinstall` - reinstall ruby and runs `gem pristine` on all gems. Make sure to read output. Use `all` for all rubies
* `reload` - reload rvm source itself (useful after changing rvm source).
* `remove` - uninstall one or many ruby versions and remove their sources
* `requirements` - installs additional OS specific dependencies/requirements for building various rubies (by default run by `install`)
* `reset` - remove current and stored default & system settings
* `snapshot` - lets you backup / restore an rvm installation in a lightweight manner
* `uninstall` - uninstall one or many ruby versions, keeping their sources
* `upgrade` - lets you upgrade from one version of a ruby to another, including migrating your gemsets semi-automatically
#### Running different ruby versions
* `do` - runs an arbitrary command against specified and/or all rubies
* `use` - setup current shell to use a specific ruby version
#### Managing gemsets
* `gemset` - manage [gemsets](https://rvm.io/gemsets/)
* `migrate` - lets you migrate all gemsets from one ruby to another
#### Configuration
* `alias` - define aliases for `rvm use`
* `autolibs` - control settings for installing dependencies automatically
* `current` - print the current ruby version and the name of any gemset being used
* `gemdir` - display the path to the current gem directory (`GEM_HOME`)
* `group` - tools for managing groups in multiuser installations
* `rvmrc` - tools related to managing `.rvmrc` trust and loading
* `wrapper` - generates a set of wrapper executables for a given ruby with the specified ruby and gemset combination. Used under the hood for passenger support and the like
#### Maintenance
* `cleanup` - remove stale source folders / archives and other miscellaneous data associated with rvm
* `cron` - manage setup for using ruby in cron
* `disk-usage` - display disk space occupied by RVM
* `docs` - tools to make installing ri and rdoc documentation easier
* `fetch` - download binary or sources for selected ruby version
* `get` - upgrades RVM to latest head, stable or branched version
* `osx-ssl-certs` - helps update certificates for OpenSSL installed by rvm on OSX
#### Troubleshooting
* `config-get` - display values for `RbConfig::CONFIG` variables
* `debug` - show additional information helping to discover common issues
* `export` - temporarily set an environment variable in the current shell
* `fix-permissions` - repairs broken permissions
* `repair` - lets you repair parts of your environment e.g. wrappers, env files and similar (e.g. general maintenance)
* `rubygems` - switches the installed version of rubygems for the current ruby
* `tools` - provides general information about the ruby environment, primarily useful when scripting rvm
* `unexport` - undo changes made to the environment by `rvm export`
* `user` - tools for managing RVM mixed mode in multiuser installations
#### Information and documentation
* `info` - show the environment information for current ruby
* `notes` - display notes with operating system specifics
* `usage` - list available commands and their usage info (content of this README)
* `version` - display rvm version (equal to `rvm -v`)
### Additional global options
* `--debug` - toggle debug mode on for very verbose output
* `--trace` - toggle trace mode on to see EVERYTHING rvm is doing
* `--nice` - process niceness (increase the value on slow computers, default `0`)
* `-v` | `--version` - display rvm version loaded for current shell
## Reporting issues
Here at RVM we get a high amount of bug reports, and often they are connected
with specific environment settings which might be hard for us to replicate.
That's why we would kindly ask you to follow the steps below so we can maximize
our time helping you and minimize the time requesting more information.
### Check documentation
We know, you hear this over and over and be rest assured we are working hard to improve the
usability of https://rvm.io but we must always ask that you first please check the documentation
if you are requesting a feature or if you are not sure if you did it right.
### Try again with latest RVM
We try to release a new RVM as soon as we feel that we achieved certain stability. This might take
a while and it could be the case that your issue has been already resolved in our development branch.
Please get the latest RVM and try again:
`rvm get master`
### File an issue
If the documentation is not clear, an error message is not clear or you are stuck with the problem,
please do file a bug.
When in doubt as to whether your issue might relate to another, simply file a new bug, and
we will mark it as duplicate if it needs to be. It's always better to file a new ticket and
let us sort it out than to accidentally add noise to another ticket.
For filing issues, we have prepared a template for you to use. Please try to fill all sections as best as you can.
Always make sure to split up each command and its output into its own fenced code block.
If the output is long, please put it in a separate [gist](https://gist.github.com).
Otherwise it's hard for us to process all the information and respond quickly.
Note that if there is a lot of `debug` or `trace` output you can redirect it to a file with the `>`
character like `rvm [command] > output.txt`.
## Contributing
You are very warmly welcome to help. Please follow our [contribution guidelines](CONTRIBUTING.md)
Any and all contributions offered in any form, past present or future are understood to be in complete agreement and acceptance with the [Apache License](LICENSE) v2.0.
## License
Copyright (C) Michal Papis (2011-2017), Piotr Kuczynski (2016-2017), Wayne E. Seguin (2009-2011)
Licensed under the [Apache License](LICENSE), Version 2.0
Action documentation available with 'rvm help action-name':
alias autolibs cleanup config-get cron current debug disk-usage do docs fetch fix-permissions gemdir gemset gemset/copy get group implode info install list migrate mount notes osx-ssl-certs patchset pkg prepare reinstall remove repair requirements reset rubygems rvmrc rvmrc/to rvmrc/warning snapshot srcdir tools uninstall upgrade use user wrapper
Other topics of documentation available with 'rvm help topic':
alt color upgrade-notes
For additional information please visit RVM's documentation website: https://rvm.io/
$ rvm -v
rvm 1.29.2 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]
二、使用RVM升级Ruby
1、查看当前ruby版本
ruby -v
p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 12.0px '.PingFang SC'; color: #454545}
span.s1 {font: 12.0px 'Helvetica Neue'}
2、列出已知ruby的版本
rvm list known
稍等一下,会出现很多平台不同的ruby的版本,由于要求 2.2.2 以上,所以也别选太高的版本,避免不兼容,就选一个相对稳定的版本。
3、安装指定版本
rvm install ruby-2.2.6
4、安装完之后,可以ruby -v 测试一下,查以看到已经是 2.2.6 了。
安装过程中的部分输出需要关注一下:
Searching for binary rubies, this might take some time. No binary rubies available for: osx/10.12/x86_64/ruby-2.2.6. 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..........................................................................| Installing required packages: autoconf, automake, libtool, coreutils, libyaml, libksba...| Updating Homebrew... ==> Upgrading 3 outdated packages, with result: openssl 1.0.2l, pkg-config 0.29.2, readline 7.0.3_1 ==> Upgrading openssl ==> Downloading https://homebrew.bintray.com/bottles/openssl-1.0.2l.sierra.bottle.tar.gz ######################################################################## 100.0% ==> Pouring openssl-1.0.2l.sierra.bottle.tar.gz ==> Using the sandbox ==> Caveats
从输出可以看出 RVM 实际使用了 Homebrew 。
好了,更新完了,去做你想做的事吧。
macOS Ruby版本需要升级到2.2.2以上的更多相关文章
- 关于IOS新手在安装cocoa pods失败,因为ruby版本过低的解决方法+ (void) {升级ruby}
http://blog.csdn.net/zhaoen95/article/details/51995520 现在: 使用 OS 系统, 正在学习iOS 需要配置cocoapods 命令行中显 ...
- macos下使用rvm管理ruby版本和rails版本
1. 安装rvm curl -L https://get.rvm.io | bash -s stable 查看rvm 版本 2. 安装ruby rvm install 2.3.1 查看ruby 版本 ...
- 【转】如何在Mac 终端升级ruby版本
原文网址:https://segmentfault.com/a/1190000003784636 rvm是什么?为什么要安装rvm呢,因为rvm可以让你拥有多个版本的Ruby,并且可以在多个版本之间自 ...
- cocoapods安装以及使用,安装过程中ruby版本过低
cocoapods安装以及使用,安装过程中ruby版本过低 字数473 阅读103 评论1 喜欢2 1.打开终端 2.移除现有 Ruby 默认源 $ gem sources --remove http ...
- MAC Ruby版本需要升级至2.2.2以上
第一例: 默认情况下,Mac OS X 系统已经安装好 Ruby(最新的 Mavericks 随机的 Ruby 版本为 2.0.0p247),安装在 /System/Library/Framework ...
- 零零碎碎搞了一天最后发现是ruby版本问题
查来查去查不到问题,后来在stackoverflow看到: http://stackoverflow.com/questions/22352838/ruby-gem-install-json-fail ...
- Nginx1.8.0版本平滑升级新版本1.9.7
原文:http://www.jb51.net/article/79878.htm 首先查看现在环境nginx的版本为1.8.0 编译的参数只指定了安装路径: 复制代码代码如下: [root@local ...
- SequoiaDB版本在线升级介绍说明
1.前言 在SequoiaDB数据库发展过程中,基本保持每半年对外发行一个正式的Release版本.并且每个新发布的Release版本相对老版本而言,性能方面都有很大的提高,并且数据库也会在新版本中加 ...
- PostgreSQL版本快速升级
PostgreSQL版本快速升级 写在前面 PostgreSQL9.5版本支持数据分片的功能,为以后做分布式考虑,准备将生产环境的9.1版本升级至9.5.中间需要做数据迁移. 在迁移操作中,为保证数据 ...
随机推荐
- 关于mysql主从复制的概述与分类
一.概述: 按照MySQL的同步复制特点,大体上可以分为三种类别: 1.异步复制: 2.半同步复制: 3.完全同步的复制: -------------------------------------- ...
- 移动app自动化测试
原文出处https://www.toutiao.com/i6473606106970063374/ 原文作者是今日头条的:一个字头的诞生 在此感谢原文作者的无私分享! 移动App自动化测试(一) 目前 ...
- 笔记——Springboot response、ServletOutputStream、图形验证码显示慢
今天遇到一个图形验证码加载很慢的问题,大概耗时有200~500毫秒左右. 根据追踪,图形验证码图片生成耗时0~1毫秒,而response.getOutputStream.write()将图片写入前台页 ...
- [转]毕设- 深入HBase架构解析(一)
深入HBase架构解析(一) 前记 公司内部使用的是MapR版本的Hadoop生态系统,因而从MapR的官网看到了这篇文文章:An In-Depth Look at the HBase Archi ...
- Maven的Mirror和Repository
今天新公司入职,项目经理让迁出项目,心想maven的阿里镜像源挺快的,干脆在配置了公司私服之后自己配置了阿里的镜像源,没成想项目屡屡报错,找不到项目依赖的公司jar包,后来才发现,同事配置mirror ...
- 对MySQL数据类型的认识
简述 良好的逻辑设计和物理设计是高性能系统的基石,比如反范式设计可以加快某些类型的查询同时也会影响另外一些类型的查询效率,所以我们必须重视Mysql对于数据库的设计(本文主要讲述表字段类型对于数据库性 ...
- 20145219 《Java程序设计》第01周学习总结
20145219 <Java程序设计>第01周学习总结 教材学习内容总结 软件分类:系统软件(DOS.Windows.Linux等).应用软件(扫雷.QQ等) 人机交互方式:图形化界面.命 ...
- maven项目在eclipse的library中没有Maven Dependencies
今天使用maven创建了一个多模块的项目,在分别创建完父项目和各个子模块后,编译父项目的时候,父项目工程目录上出现了一堆红叉叉,点进去一看,是找不到依赖的类,但是pom文件中相应jar的depende ...
- 谷歌SEO老域名注册完全攻略
老域名有优势,不管在百度和谷歌都是一样的. 我们查看搜索结果就能发现,谷歌里面很多排前十的网站都是N年前的,一零年以后的算是比较新的,很多产品网站域名是零几年,甚至很多排名更好的域名是九几年的. 谷歌 ...
- eclipse显示结果窗口字体大小
设置前的字体大小 设置后的字体大小 步骤