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.中间需要做数据迁移. 在迁移操作中,为保证数据 ...
随机推荐
- Java并发(3):volatile及Java内存模型
Java 语言中的 volatile 变量可以被看作是一种“程度较轻的 synchronized“:与 synchronized 块相比,volatile 变量所需的编码较少,并且运行时开销也较少,但 ...
- js高级---js运行原理
概述 浏览器组成可分两部分:Shell+内核.浏览器内核又可以分成两部分:渲染引擎(layout engineer或者Rendering Engine)和JS引擎.渲染引擎功能作用 渲染引擎,负责对网 ...
- 微信小程序之日期与时间插件
页面 <picker mode="time" value="{{time}}" start="{{minTime}}" end=&qu ...
- [LeetCode] 139 Word Break(BFS统计层数的方法)
原题地址: https://leetcode.com/problems/word-break/description/ 题目: Given a non-empty string s and a dic ...
- Record and accumulation
最近有同学在准备校招的问题,问我几个问题,我觉得有必要把大家的问题汇总下: 1.在设计变量的while指挥时候,可以利用弹栈的特性以及Java传值 只是传递的副本 去控制 : https://www ...
- SSL证书是“盾牌“还是”鸡肋“?
德国联邦安全与IT办公室(BSI,职能相当于美国的国家安全与信息技术局)近日发布公告警告:网络攻击者冒充其发布了“关于Meltdown与Spectre攻击信息”的垃圾邮件,该邮件中包含指向修复补丁的页 ...
- sql server 2014 在windows server 2012 上安装Analysis Services
Analysis Services Account Name : NT AUTHORITY\SYSTEM
- Java子类强制转父类类型不会变
class A{ void a(){ System.out.println("parent'a()"); }} class AA extends A{ ...
- Java IO操作——数据操作流DataOutputStream和DataInputStream的使用
学习目标 掌握DataOutputStream和DataInputStream的作用 可以使用DataOutputStream和DataInputStream写入和读入数据 数据操作流 在io包中, ...
- vs添加静态链接库+添加动态链接库+添加头文件目录
头文件添加方法:工程---属性---配置属性---c/c++---常规---附加包含目录(Additional Include Directories):加上头文件存放目录.注意:(1)路径必须指向头 ...