COCOAPODS:安装/更新RUBY环境教程
来源:互联网 发布:悦游网络加速器官网 编辑:程序博客网 时间:2024/05/16 08:40
简介
有时候在安装cocoapods时会产生如下错误
<code class="hljs http has-numbering"><span class="hljs-attribute" style="color: rgb(163, 21, 21);">ERROR: <span class="hljs-string"> Error installing cocoapods: activesupport requires Ruby version >= 2.2.2.</span></span></code>
- 1
这就说明,你的Ruby环境需要升级更新, 我以mac OS 10.11 下更新ruby方法为例, 说一说更新Ruby环境的详细步骤.
原因和方案
在安装cocoapods过程中提示需要Ruby的版本在2.2.2以上,而目前使用的Ruby版本是Mac系统自带的1.8.7。所以需要对Ruby进行升级。以下是安装Ruby的三种方法:
1.下载ruby源代码,编译,安装
2.使用发行版自带的安装包,安装
3.使用 rvm安装
通过rvm安装Ruby详细步骤
这里还是推荐大家通过rvm对Ruby进行升级的.
1>安装 ram
RVM:Ruby Version Manager,Ruby版本管理器,包括Ruby的版本管理和Gem库管理(gemset)
<code class="hljs avrasm has-numbering">$ curl -L get<span class="hljs-preprocessor">.rvm<span class="hljs-preprocessor">.io | bash -s stable</span></span></code>
2>加载文件, 测试是否安装正常(按照提示操作)
<code class="hljs smalltalk has-numbering"><span class="hljs-char">$ source ~/.bashrc <span class="hljs-char">$ source ~/.bash_profile <span class="hljs-char">$ source ~/.profile<span class="hljs-char">$ rvm -v</span></span></span></span></code>
3>如果有下面的提示, 请reload rvm
<code class="hljs livecodeserver has-numbering">A RVM <span class="hljs-built_in" style="color: rgb(0, 0, 255);">version <span class="hljs-number">1.27<span class="hljs-number">.0 (latest) is installed yet <span class="hljs-number">1.25<span class="hljs-number">.23 (stable) is loaded.Please <span class="hljs-built_in">do <span class="hljs-constant">one <span class="hljs-operator">of <span class="hljs-operator">the following: * <span class="hljs-string" style="color: rgb(163, 21, 21);">'rvm reload' * <span class="hljs-built_in" style="color: rgb(0, 0, 255);">open <span class="hljs-operator">a <span class="hljs-built_in">new <span class="hljs-built_in">shell * <span class="hljs-string" style="color: rgb(163, 21, 21);">'echo rvm_auto_reload_flag=1 >> ~/.rvmrc' <span class="hljs-comment" style="color: green;"># for auto reload with msg. * <span class="hljs-string" style="color: rgb(163, 21, 21);">'echo rvm_auto_reload_flag=2 >> ~/.rvmrc' <span class="hljs-comment" style="color: green;"># for silent auto reload.</span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></span></code>
输入命令:
<code class="hljs ruby has-numbering"><span class="hljs-variable" style="color: green;">$ rvm reload<span class="hljs-variable">$ rvm -v</span></span></code>
4>查看当前ruby版本 ,获取rvm 列表
<code class="hljs ruby has-numbering"><span class="hljs-variable" style="color: green;">$ ruby -v <span class="hljs-variable">$ rvm list known </span></span></code>
5>安装ruby可能出的错误 (若未出错, 请跳过进入第6步)
<code class="hljs ruby has-numbering"><span class="hljs-variable" style="color: green;">$ rvm install <span class="hljs-number">2.3</span></span></code>
- 1
错误1: 在安装ruby的时候, 可能会如下报错, 提示 Updating system[YourMacName] password required for ‘port -dv self update’, 如下:
解决:
进行更新:
<code class="hljs ruby has-numbering"><span class="hljs-variable" style="color: green;">$ sudo port <span class="hljs-keyword" style="color: rgb(0, 0, 255);">self update</span></span></code>
更新完成后, 如图:
错误2:
或者你可能遇到如下错误, 原因是需要安装Homebrew.
<code class="hljs livecodeserver has-numbering">Error running <span class="hljs-string" style="color: rgb(163, 21, 21);">'requirements_osx_port_libs_install curl-ca-bundle automake libtool libyaml libffi libksba',showing <span class="hljs-keyword" style="color: rgb(0, 0, 255);">last <span class="hljs-number">15 <span class="hljs-keyword">lines <span class="hljs-operator">of /Users/acewill/.rvm/<span class="hljs-built_in">log/<span class="hljs-number">1468253599_ruby-<span class="hljs-number">2.3<span class="hljs-number">.0/package_install_curl-ca-bundle_automake_libtool_libyaml_libffi_libksba.<span class="hljs-built_in">log</span></span></span></span></span></span></span></span></span></span></code>
解决:
参照stack overflow上的问题Installing RVM: “Requirements installation failed with status: 1.”
需要安装Homebrew , 通过以下命令:
<code class="hljs bash has-numbering">ruby <span class="hljs-operator">-e <span class="hljs-string" style="color: rgb(163, 21, 21);">"<span class="hljs-variable" style="color: green;">$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"</span></span></span></code>
6>重新安装ruby
安装完成后, 重新执行安装cocoapods的命令.
<code class="hljs ruby has-numbering"><span class="hljs-variable" style="color: green;">$ rvm install <span class="hljs-number">2.3</span></span></code>
7>安装rails
<code class="hljs ruby has-numbering"><span class="hljs-variable" style="color: green;">$ gem install rails</span></code>
8>卸载ruby方法
获取ruby已安装列表, 然后卸载ruby
<code class="hljs ruby has-numbering"><span class="hljs-variable" style="color: green;">$ rvm list<span class="hljs-variable">$ rvm remove <span class="hljs-number">2.3</span></span></span></code>
- cocoapods:安装/更新Ruby环境教程
- COCOAPODS:安装/更新RUBY环境教程
- cocoapods:安装以及更新Ruby环境教程
- cocoapods安装Ruby环境
- Mac上更新Ruby,安装cocoapods详细教程
- Mac上更新Ruby,安装cocoapods详细教程
- mac 安装 CocoaPods 教程 (包括 Ruby 环境安装)
- Mac上更新Ruby及安装 CocoaPods
- 安装CocoaPods及安装Ruby环境
- CocoaPods的安装方法 安装ruby环境
- CocoaPods安装和使用教程 -- (Mac本地安装Ruby环境)
- 在Mac OS X上安装 Ruby运行环境 CocoaPods安装和使用教程
- Mac上安装 Ruby运行环境以及CocoaPods的安装使用教程
- 在Mac OS X上安装 Ruby运行环境 CocoaPods安装和使用教程
- Mac机中安装RUBY环境,CocoaPods安装和使用教程(★firecat推荐★)
- CocoaPods安装和Ruby环境搭建
- ruby环境搭建 CocoaPods安装 使用
- ruby环境搭建 CocoaPods安装和使用
- 我排第几个
- Notification发送通知
- git操作指令
- 第一篇
- 不只是gdb
- COCOAPODS:安装/更新RUBY环境教程
- POJ-3126-Prime Path
- Apache2.4 + Tomcat 6.0 集群部署 64位
- 键盘按钮keyCode大全
- Shell编程规范
- JDK环境变量配置
- lambda expressions are not supported at this language level(需设置project language level)
- 拉链法哈希表添加
- Python 爬虫第二步 -- 爬取麦子学院课程信息