cocoapods的安装 遇到 Error installing pods:activesupport requires Ruby version >=2.2.2

1.打开终端
2 移除现有 Ruby 默认源 输入以下指令
$gem sources –remove https://rubygems.org/

3.使用新的源 输入以下指令
$gem sources -a https://ruby.taobao.org/

4.验证新源是否替换成功 输入以下指令
$gem sources -l

5.安装 CocoaPods
$sudo gem install cocoa pods

//–––––––––––那么问题来了——没遇到的自动跳过————————————

错误提示1
Error installing cocoapods: activesupport requires Ruby version >= 2.2.2.

解决方案 :
1、安装 RVM baby 版本管理器

$curl -L get.rvm.io | bash -s stable

//等安装完成 出现下面这行提示以下___

In case of problems: https://rvm.io/helpandhttps://twitter.com/rvm_io

执行

$source ~/.bashrc

$source ~/.bash_profile

测试是否安装正常

$rvm -v

//提示以下___

rvm 1.27.0 (latest) by Wayne E. Seguin, Michal Papis[https://rvm.io/]

2、用RVM升级Ruby查看当前ruby版本

$ruby -v

$rvm list known

//提示以下___

MRI Rubies

[ruby-]1.8.6[-p420]

[ruby-]1.8.7[-head] # security released on head

[ruby-]1.9.1[-p431]

[ruby-]1.9.2[-p330]

[ruby-]1.9.3[-p551]

[ruby-]2.0.0[-p648]

[ruby-]2.1[.8]

[ruby-]2.2[.4]

[ruby-]2.3[.0]

[ruby-]2.2-headruby-head

for forks use: rvm install ruby-head—url https://github.com/github/ruby.git –branch 2.2

JRuby

安装ruby 2.2.2 执行

$rvm install 2.2.24. 继续安装 CocoaPods

$sudo gem install cocoa pods

$sudo gem install -n /usr/local/bin cocoapods

$pod setup

  1. 更新 gem
    $sudo gem update –system

  2. 新建一个项目,名字PodTest

  3. $ cd 项目路径 (中间有空格,)
    cd /Users/lucky/Desktop/PodTest

  4. 建立Podfile(配置文件)
    $vim Podfile

键盘输入 i 进入编辑模式,输入

platform :ios, ‘7.0’

pod ‘MBProgressHUD’, ‘~> 0.8’ (之前的,我的电脑上已经无效了,报错: [!] The dependency MBProgressHUD (~> 0.8) is not used in any concrete target.)

(现在使用:MyApp 替换成自己的项目名)

target ‘MyApp’ do

pod ‘AFNetworking’, ‘~> 2.6’

pod ‘ORStackView’, ‘~> 3.0’

end

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值