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..

解决方案 :

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.[-p420]

[ruby-]1.8.[-head] # security released on head

[ruby-]1.9.[-p431]

[ruby-]1.9.[-p330]

[ruby-]1.9.[-p551]

[ruby-]2.0.[-p648]

[ruby-]2.1[.]

[ruby-]2.2[.]

[ruby-]2.3[.]

[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.

如果打印:

……  ruby-2.2. - #validate archive
ruby-2.2. - #extract
ruby-2.2. - #validate binary
ruby-2.2. - #setup
ruby-2.2. - #gemset created /Users/abc/.rvm/gems/ruby-2.2.@global
ruby-2.2. - #importing gemset
/Users/abc/.rvm/gemsets/global.gems..............................
ruby-2.2. - #generating global wrappers........
ruby-2.2. - #gemset created /Users/abc/.rvm/gems/ruby-2.2.
ruby-2.2. - #importing gemsetfile /Users/abc/.rvm/gemsets/default.gems
  evaluated to empty gem list
ruby-2.2. - #generating default wrappers........
Updating certificates in '/etc/openssl/cert.pem'.
mkdir: /etc/openssl: Permission denied
mkdir -p "/etc/openssl" failed, retrying with sudo
LiuWenqiang password required for 'mkdir -p /etc/openssl':
and sudo mkdir worked

则说明安装成功了

打印代码:

Done with Command Line Tools (OS X 10.11) for Xcode
Done.
==> /usr/bin/sudo /bin/rm -f /tmp/.com.apple.dt.CommandLineTools.installondemand.in-progress
==> Installing the Command Line Tools (expect a GUI popup):
==> /usr/bin/sudo /usr/bin/xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Failed during: /usr/bin/sudo /usr/bin/xcode-select --install
Requirements installation failed with status: .

4.  继续安装 CocoaPods

$sudo gem install cocoa pods

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

$pod setup

5.  更新 gem

$sudo gem update --system

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

7.    $ cd  项目路径 (中间有空格,)

    cd /Users/lucky/Desktop/PodTest   

8.   建立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

然后

按Esc,并且输入“ :”号进入vim命令模式,然后在冒号后边输入wq

再输入

 $pod install

注意:现在打开项目不是点击 PodTest.xodeproj了,而是点击 PodTest.xcworkspace

为了确定AFNetworking是否支持CocoaPods,可以用CocoaPods的搜索功能验证一下。在终端中输入:

$ pod search AFNetworking

###如果安装失败

干货1:

安装ruby遇到" Installing Homebrew - Brew Command Not Found"命令找不到解决方案:

Check XCode is installed or not.

$gcc --version

$ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

$brew doctor

$brew update.

完成后 执行

$ruby -v
//–––––打印输出–––––––

ruby 2.2.2p95 (-- revision ) [x86_64-darwin14]

6 继续安装 CocoaPods

$sudo gem install cocoa pods
//______安装成功提示如下______

Done installing documentation for nap, fourflusher, escape, colored, concurrent-ruby, thread_safe, tzinfo, i18n, activesupport, claide, xcodeproj, molinillo, cocoapods-try, netrc, cocoapods-trunk, cocoapods-stats, cocoapods-search, cocoapods-plugins, cocoapods-downloader, cocoapods-deintegrate, fuzzy_match, cocoapods-core, cocoapods after  seconds, gems installed
$pod setup

备注:苹果系统升级 OS X EL Capitan 后安装改为:

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

干货2:

CocoaPods无限卡在Setting up CocoaPods master repo解决方案:

对于初次使用CocoaPods的同学,即使你不使用pod setup命令,在你初次执行pod install命令时,系统也会自动执行pod setup。而由于网络不稳定的原因,不挂VPN是不可能成功执行pod setup的。(我大天朝的墙啊~~~~)

$ pod repo remove master

$ git clone https://github.com/CocoaPods/Specs.git ~/.cocoapods/repos/master

$ pod repo update

7 更新 gem

$sudo gem update --system

8 新建工程,并在终端用 cd 指令到文件夹内

$pod search 第三方库

9 新建 Podfile 文件

$ touch Podfile

10 编辑 Podfile 文件,并写入要添加的第三方库(cocoapod1.0.1版本Podfile文件的内容格式要求发生了变化,必须指出指出所用第三方库的target)

platform:ios, '8.0'

#use_frameworks!个别需要用到它,比如reactiveCocoa

target 'XXXApp' do

pod 'AFNetworking', '2.3.1'<-------第三方

end

11 导入第三方库

$pod install --no-repo-update
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
Failed during: /usr/bin/sudo /usr/bin/xcode-select --install
Requirements installation failed with status: . 此时查询Xcode,切换到另一个环境: $ sudo xcode-select --switch /Library/Developer/CommandLineTools/
Password:
$ git
usage: git [--version] [--help] [-C <path>] [-c name=value]
[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]
[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]
[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]
<command> [<args>]
ERROR: Error installing cocoapods:
activesupport requires Ruby version >= 2.2..
localhost:~ zzz$ $curl -L get.rvm.io | bash -s stable
-bash: -L: command not found
localhost:~ zzz$

解决方法:

ruby -e "$(wget -qO - 'https://raw.github.com/mxcl/homebrew/go')" 

$ sudo xcode-select --switch /Library/Developer/CommandLineTools/

Password: (输入电脑权限密码)

$ git
usage: git [--version] [--help] [-C <path>] [-c name=value]

[--exec-path[=<path>]] [--html-path] [--man-path] [--info-path]

[-p | --paginate | --no-pager] [--no-replace-objects] [--bare]

[--git-dir=<path>] [--work-tree=<path>] [--namespace=<name>]

<command> [<args>]
 

Cocoapods的安装报错 - Error installing pods:activesupport requires Ruby version >=2.2.2的更多相关文章

  1. 在执行gem install redis时 : ERROR: Error installing redis: redis requires Ruby version >= 2.2.2

    在执行gem install redis时 提示: gem install redis ERROR: Error installing redis: redis requires Ruby versi ...

  2. iOS的CocoaPods(activesupport requires Ruby version >= 2.2.2)

    如果你在安装遇到这个问题 activesupport requires Ruby version >= 2.2.2,那么这里可以帮助你(lasted version) 如果你是通过 http:/ ...

  3. go报错unimplemented: 64-bit mode not compiled in与mingw 64位安装报错ERROR res已解决

    问题一:cc1.exe: sorry, unimplemented: 64-bit mode not compiled in 参考:https://www.cnblogs.com/lesroad/p/ ...

  4. CocoaPods 报错 [!] Error installing JSONModel

    pod install p.p1 { margin: 0.0px 0.0px 0.0px 0.0px; font: 11.0px Menlo; color: #34bd26 } span.s1 { } ...

  5. python3 pip 安装Scrapy在win10 安装报错error: Microsoft Visual C++ 14.0 is required. Get it with "Microsoft Visual C++ Build Tools": http://landinghub.visualstudio.com/visual-cpp-build-tools

    问题描述 当前环境win10,python_3.6.1,64位. 在windows下,在dos中运行pip install Scrapy报错: building 'twisted.test.raise ...

  6. python安装报错error writing to file:......

    今天换了win10 64电脑,安装python3.6.8时,报错:error writing to file:...... 安装时,右键--以管理员身份运行,安装成功.

  7. wordcloud的安装报错 error: Microsoft Visual C++ 10.0 is required. Get it with "Microsoft Windows SDK 7.1"解决办法

    cmd中使用pip install wordcloud失败,没看懂报错的原因…… 而在pycharm中添加也报错 解决方法: 1. 下载wordcloud-1.4.1.tar.gz,解压缩 cmd c ...

  8. mha安装报错 [error][/usr/share/perl5/vendor_perl/MHA/MasterMonitor.pm, ln361] None of slaves can be master. Check failover configuration file or log-bin settings in my.cnf

    查找资料 参考 http://blog.51cto.com/16769017/1878451 解决方法: 在两个从库上开启二进制日志即可(花了 一天时间,找不到解决方法,最后还是靠自己的理解及测试解决 ...

  9. memcached安装报错 error while loading shared libraries: libevent-2.0.so.5: cannot open shared object file: No such file or directory解决

    我是从其他服务器scp来的memcached(~~~整个文件夹的那种,windows用多了的后遗症) 在准备运行 ./memcached -d -u root -l localhost -m 800 ...

随机推荐

  1. Javascript高级程序设计——基本类型和引用类型的值

    ECMAScript中的变量有两种不同的数据类型的值: 基本类型:基本类型的值是简单的数据段.包括:Undefined.Null.Number.Boolean.String五种 引用类型:引用类型的值 ...

  2. C++中的单例模式(转)

    单例模式也称为单件模式.单子模式,可能是使用最广泛的设计模式.其意图是保证一个类仅有一个实例,并提供一个访问它的全局访问点,该实例被所有程序模块共享.有很多地方需要这样的功能模块,如系统的日志输出,G ...

  3. 又一个绝对棒的对话框插件fancybox v1.3.4

    http://www.jsfoot.com/jquery/demo/2011-07-30/fancybox/index.html jquery插件:fancybox   Fancybox的特点如下: ...

  4. 教你如何在Kali Linux 环境下设置蜜罐?

    导读 Pentbox是一个包含了许多可以使渗透测试工作变得简单流程化的工具的安全套件.它是用Ruby编写并且面向GNU/Linux,同时也支持Windows.MacOS和其它任何安装有Ruby的系统. ...

  5. 十进制转为N进制

    昨天笔试遇到的题,如果是正数,不断以余数做除法即可: void convert(int num, int N, vector<char>& data) { int number = ...

  6. RouterOS首次打开网页强制跳转

    网上极少有关于RouterOS的第一次打开网页强制跳转主页的方法,大多数都方法是将浏览某个域名的IP地址跳转到自己的主页,这种方法有时会失效.还有一种方法就是当用户用80端口连接时,抓取源地址到地址列 ...

  7. 2016年10月31日--网页 Windows对象操作

    Window.opener:打开当前窗口的源窗口,如果当前窗口是首次启动浏览器打开的,则opener是null. Window.open(URL,name,features,replace):open ...

  8. django的ajax对应前端的瀑布流方法

    html {% load xx %} <!DOCTYPE html> <html lang="en"> <head> <meta char ...

  9. django xadmin 模板的定制

    编辑新增等页面对应的modelform为ModelFormAdminView (xadmin.views.edit.ModelFormAdminView) 通过源码分析,新增对象的template属性 ...

  10. PHP程序员如何突破成长瓶颈(php开发三到四年)

    看了这篇博文,我正好处于这个阶段,也有心要突破自己,呵呵! 作为Web开发中应用最广泛的语言之一,PHP有着大量的粉丝,那么你是一名优秀的程序员吗?在进行自我修炼的同时,你是否想过面对各种各样的问题, ...