博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
macOS Ruby版本需要升级到2.2.2以上
阅读量:5928 次
发布时间:2019-06-19

本文共 12665 字,大约阅读时间需要 42 分钟。

在安装 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.gzDownloading https://github.com/rvm/rvm/releases/download/1.29.2/1.29.2.tar.gz.ascFound 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 不带参数会显示帮助信息。

    Master# What's RVMRVM 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### UbuntuRVM 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 systemMake sure you have following required packages installed:* `curl`And then run:`\curl -sSL https://get.rvm.io | bash -s stable`### Additional installation optionsAdditional installation options and details about the installation process are described here: https://rvm.io/rvm/install## Upgrading RVMYou 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 usageBasic RVM usage scenarios include installing and switching between different ruby versions.### Installing rubyTo 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 assumethat you wanted to install MRI ruby. Following examples would have exactly the same effect:    ```rvm install ruby-2.3.1rvm install ruby-2.3rvm install 2.3.1rvm 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 RPythonHistorical 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 versionsTo 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 commandsRVM 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 issuesHere 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 documentationWe know, you hear this over and over and be rest assured we are working hard to improve theusability of https://rvm.io but we must always ask that you first please check the documentationif you are requesting a feature or if you are not sure if you did it right.### Try again with latest RVMWe try to release a new RVM as soon as we feel that we achieved certain stability. This might takea 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 issueIf 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, andwe will mark it as duplicate if it needs to be.  It's always better to file a new ticket andlet 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`.## ContributingYou 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.## LicenseCopyright (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 -vrvm 1.29.2 (latest) by Michal Papis, Piotr Kuczynski, Wayne E. Seguin [https://rvm.io/]

二、使用RVM升级Ruby

1、查看当前ruby版本

ruby -v

2、列出已知ruby的版本

rvm list known

稍等一下,会出现很多平台不同的ruby的版本,

转载地址:http://qxsvx.baihongyu.com/

你可能感兴趣的文章
如何更改Exchange Server 最多发送90人的默认设置
查看>>
快速构建Windows 8风格应用12-SearchContract概述及原理
查看>>
那些年我们追过的桌面虚拟化技术-浅析
查看>>
powershell 修改笔记本的电源设置
查看>>
Methods of quick exploitation of blind SQL Injection Vulnerabilities in Oracle
查看>>
Django 路由系统简述
查看>>
Liferay Dynamic CSS Filter方法的研究 - 计算资源文件的缓存base名
查看>>
DataGridView 判断新增行:
查看>>
Apache配置实现cgi
查看>>
基于OHCI的USB主机 —— 中断向量处理
查看>>
【干货】如何排查移动站点流量异常
查看>>
ubuntu 升级后没有载入vboxdrv 模块
查看>>
Angular企业级开发(5)-项目框架搭建
查看>>
.Net Micro Framework开发板用户简明手册
查看>>
一步一步SharePoint 2007之四十五:实现自定义Workflow(4)——运行Workflow
查看>>
DataGrid Web Control 连载之六
查看>>
敏捷个人手机应用:如何使用时中法习惯
查看>>
python写的简单发送邮件的脚
查看>>
Spring MVC应用web.xml两种配置
查看>>
linux shell 菜单
查看>>