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.中间需要做数据迁移. 在迁移操作中,为保证数据 ...
随机推荐
- go——反射
反射(reflect)让我们能在运行期探知对象地类型信息和内存结构,这从一定程度上弥补了静态语言在动态行为上地不足.和C数据结构一样,Go对象头部并没有类型指针,通过其自身是无法在运行期获知任何类型相 ...
- sqlserver建立相同的表结构
select * into purpose from source 来自为知笔记(Wiz)
- 大数据生态,哪些框架需要全部启动,哪些只启动master,仅为汇总
主从,只需要在master节点启动 hadoop hbase 单机启动 hive 其他,需要启动每个节点 zookeeper kafka flume presto
- JavaWeb请求中文乱码
解决中文乱麻问题,页面端发出的数据作两次encodeURI var name="张三"; encodeURI(encodeURI(name)); 后台解码: URLDecoder. ...
- 20145217《信网络对抗》逆向与BOF基础实践
20145217<信网络对抗>逆向与BOF基础实践 内容: 一.简单机器指令,汇编语言 1.'objdump -d xxx|more'反汇编命令查看机器代码,'cat'显示文件内容,'xx ...
- 通俗理解数字签名,数字证书和https
最近在开发关于PDF合同文档电子签章的功能,大概意思就是在一份PDF合同上签名,盖章,使其具有法律效应.签章有法律效应必须满足两个条件: 能够证明签名,盖章者是谁,无法抵赖 PDF合同在签章后不能被更 ...
- 关于使用UniForm以其他控件为Parent时应该注意的问题
关于使用UniForm以其他控件为Parent时应该注意的问题: 1,不能在其他组件的oncreate,onbeforeshow,onshow等事件中来生成这样的uniform,否则其上的组件不能显示 ...
- LeetCode——Diameter of Binary Tree
LeetCode--Diameter of Binary Tree Question Given a binary tree, you need to compute the length of th ...
- EYES组——软件体系结构上机规划
EYES组——软件体系结构上机规划 考勤助手 第九周: 需求分析的详细撰写,并在此基础上探讨与完善,讨论软件的体系结构风格,画出初步的UML类图. 第十周: 选择合适的软件构架风格(3层C/S架构风格 ...
- Spring -- aop(面向切面编程),前置&后置&环绕&抛异常通知,引入通知,自动代理
1.概要 aop:面向方面编程.不改变源代码,还为类增加新的功能.(代理) 切面:实现的交叉功能. 通知:切面的实际实现(通知要做什么,怎么做). 连接点:应用程序执行过程期间,可以插入切面的地点. ...