1.移除现有的Ruby

$gem sources --remove https://rubygems.org/

2.使用淘宝镜像

$gem sources -a https://ruby.taobao.org/

3.验证当前ruby版本

$gem sources -l

成功后提示:

*** CURRENT SOURCES ***

https://ruby.taobao.org/

4.开始安装cocoapods

$sudo gem install cocoapods

这时候提示:

Fetching: i18n-0.7.0.gem (100%)

Successfully installed i18n-0.7.0

Fetching: thread_safe-0.3.5.gem (100%)

Successfully installed thread_safe-0.3.5

Fetching: tzinfo-1.2.2.gem (100%)

Successfully installed tzinfo-1.2.2

Fetching: minitest-5.9.0.gem (100%)

Successfully installed minitest-5.9.0

Fetching: concurrent-ruby-1.0.2.gem (100%)

Successfully installed concurrent-ruby-1.0.2

Fetching: activesupport-5.0.0.gem (100%)

ERROR:  Error installing cocoapods:

activesupport requires Ruby version >= 2.2.2.

这个地方很坑,之前安装cocoapods一直是没有这个问题的,这里提示Ruby版本要大于或等于2.2.2

于是查看ruby版本

$ruby -v

ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin15]

 

果然这里就要升级Ruby版本啦

查看目前的所有ruby版本:

$rvm list known

如果提示command not found 请先安装rvm

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

如果已安装会列出所有的ruby版本:

# 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-head

ruby-head

# for forks use: rvm install ruby-head-<name> --url https://github.com/github/ruby.Git --branch 2.2

# JRuby

jruby-1.6[.8]

jruby-1.7[.23]

jruby[-9.0.5.0]

jruby-head

# Rubinius

rbx-1[.4.3]

rbx-2.3[.0]

rbx-2.4[.1]

rbx[-2.5.8]

rbx-head

# Opal

opal

# Minimalistic ruby implementation - ISO 30170:2012

mruby[-head]

# Ruby Enterprise Edition

ree-1.8.6

ree[-1.8.7][-2012.02]

# GoRuby

goruby

# Topaz

topaz

# MagLev

maglev[-head]

maglev-1.0.0

# Mac OS X Snow Leopard Or Newer

macruby-0.10

macruby-0.11

macruby[-0.12]

macruby-nightly

macruby-head

# IronRuby

ironruby[-1.1.3]

ironruby-head

 

这里我们安装2.2.2:

$rvm install 2.2.2

终端运行结果:(如果直接成功请绕过homebrew的卸载安装)

Searching for binary rubies, this might take some time.

Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/10.11/x86_64/ruby-2.2.2.tar.bz2

Checking requirements for osx.

About to install Homebrew, press `Enter` for default installation in `/usr/local`,

type new path if you wish custom Homebrew installation (the path needs to be writable for user)

:

 

回车:

It appears Homebrew is already installed. If your intent is to reinstall you

should do the following before running this installer again:

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

The current contents of /usr/local are .git

Requirements installation failed with status: 1.

 

这里执行:

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

卸载home-brew

Warning: This script will remove:

/Library/Caches/Homebrew/

/usr/local/.git/

Are you sure you want to uninstall Homebrew? [y/N] y

==> Removing Homebrew installation...

==> Removing empty directories...

==> Homebrew uninstalled!

You may want to restore /usr/local's original permissions

sudo chmod 0755 /usr/local

sudo chgrp wheel /usr/local

再执行:

$ rvm install 2.2.2

提示:

Searching for binary rubies, this might take some time.

Found remote file https://rvm_io.global.ssl.fastly.net/binaries/osx/10.11/x86_64/ruby-2.2.2.tar.bz2

Checking requirements for osx.

About to install Homebrew, press `Enter` for default installation in `/usr/local`,

type new path if you wish custom Homebrew installation (the path needs to be writable for user)

:

按回车:

==> This script will install:

/usr/local/bin/brew

/usr/local/Library/...

/usr/local/share/doc/homebrew

/usr/local/share/man/man1/brew.1

/usr/local/share/zsh/site-functions/_brew

/usr/local/etc/bash_completion.d/brew

Press RETURN to continue or any other key to abort

==> /usr/bin/sudo /bin/mkdir /Library/Caches/Homebrew

Password:

这里需要输入电脑密码:

==> /usr/bin/sudo /bin/chmod g+rwx /Library/Caches/Homebrew

==> /usr/bin/sudo /usr/sbin/chown haha /Library/Caches/Homebrew

==> Downloading and installing Homebrew...

remote: Counting objects: 501, done.

remote: Compressing objects: 100% (445/445), done.

remote: Total 501 (delta 29), reused 360 (delta 27), pack-reused 0

Receiving objects: 100% (501/501), 787.83 KiB | 169.00 KiB/s, done.

Resolving deltas: 100% (29/29), done.

From https://github.com/Homebrew/brew

* [new branch]      master     -> origin/master

HEAD is now at 32f7e73 download_strategy: ensure fixed commit hash length

==> Tapping homebrew/core

Cloning into '/usr/local/Library/Taps/homebrew/homebrew-core'...

remote: Counting objects: 3714, done.

remote: Compressing objects: 100% (3598/3598), done.

remote: Total 3714 (delta 14), reused 2112 (delta 6), pack-reused 0

Receiving objects: 100% (3714/3714), 2.88 MiB | 240.00 KiB/s, done.

Resolving deltas: 100% (14/14), done.

Checking connectivity... done.

Checking out files: 100% (3717/3717), done.

Tapped 3591 formulae (3,740 files, 9.0M)

==> Installation successful!

==> Next steps

Run `brew help` to get started

Further documentation: https://git.io/brew-docs

==> Homebrew has enabled anonymous aggregate user behaviour analytics

Read the analytics documentation (and how to opt-out) here:

https://git.io/brew-analytics

Installing requirements for osx.

Updating system.....

Installing required packages: autoconf, automake, libtool, pkg-config, libyaml, readline, libksba, openssl........

Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.

Requirements installation successful.

ruby-2.2.2 - #configure

ruby-2.2.2 - #download

% Total    % Received % Xferd  Average Speed   Time    Time     Time  Current

Dload  Upload   Total   Spent    Left  Speed

100 6854k  100 6854k    0     0  61342      0  0:01:54  0:01:54 --:--:--  132k

ruby-2.2.2 - #validate archive

ruby-2.2.2 - #extract

ruby-2.2.2 - #validate binary

ruby-2.2.2 - #setup

ruby-2.2.2 - #gemset created /Users/haha/.rvm/gems/ruby-2.2.2@global

ruby-2.2.2 - #importing gemset /Users/haha/.rvm/gemsets/global.gems..............................

ruby-2.2.2 - #generating global wrappers........

ruby-2.2.2 - #gemset created /Users/haha/.rvm/gems/ruby-2.2.2

ruby-2.2.2 - #importing gemsetfile /Users/haha/.rvm/gemsets/default.gems evaluated to empty gem list

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

haha password required for 'mkdir -p /etc/openssl':

and sudo mkdir worked

 

这样ruby2.2.2就安装好了

现在就可以安装cocoapods啦:

$sudo gem install cocoapods

看看这样cocoapods就安装成功了

Fetching: nap-1.1.0.gem (100%)

Successfully installed nap-1.1.0

Fetching: fourflusher-0.3.2.gem (100%)

Successfully installed fourflusher-0.3.2

Fetching: escape-0.0.4.gem (100%)

Successfully installed escape-0.0.4

Fetching: colored-1.2.gem (100%)

Successfully installed colored-1.2

Fetching: concurrent-ruby-1.0.2.gem (100%)

Successfully installed concurrent-ruby-1.0.2

Fetching: thread_safe-0.3.5.gem (100%)

Successfully installed thread_safe-0.3.5

Fetching: tzinfo-1.2.2.gem (100%)

Successfully installed tzinfo-1.2.2

Fetching: i18n-0.7.0.gem (100%)

Successfully installed i18n-0.7.0

Fetching: activesupport-5.0.0.gem (100%)

Successfully installed activesupport-5.0.0

Fetching: claide-1.0.0.gem (100%)

Successfully installed claide-1.0.0

Fetching: xcodeproj-1.1.0.gem (100%)

Successfully installed xcodeproj-1.1.0

Fetching: molinillo-0.4.5.gem (100%)

Successfully installed molinillo-0.4.5

Fetching: cocoapods-try-1.0.0.gem (100%)

Successfully installed cocoapods-try-1.0.0

Fetching: netrc-0.7.8.gem (100%)

Successfully installed netrc-0.7.8

Fetching: cocoapods-trunk-1.0.0.gem (100%)

Successfully installed cocoapods-trunk-1.0.0

Fetching: cocoapods-stats-1.0.0.gem (100%)

Successfully installed cocoapods-stats-1.0.0

Fetching: cocoapods-search-1.0.0.gem (100%)

Successfully installed cocoapods-search-1.0.0

Fetching: cocoapods-plugins-1.0.0.gem (100%)

Successfully installed cocoapods-plugins-1.0.0

Fetching: cocoapods-downloader-1.0.1.gem (100%)

Successfully installed cocoapods-downloader-1.0.1

Fetching: cocoapods-deintegrate-1.0.0.gem (100%)

Successfully installed cocoapods-deintegrate-1.0.0

Fetching: fuzzy_match-2.0.4.gem (100%)

Successfully installed fuzzy_match-2.0.4

Fetching: cocoapods-core-1.0.1.gem (100%)

Successfully installed cocoapods-core-1.0.1

Fetching: cocoapods-1.0.1.gem (100%)

Successfully installed cocoapods-1.0.1

Parsing documentation for nap-1.1.0

Installing ri documentation for nap-1.1.0

Parsing documentation for fourflusher-0.3.2

Installing ri documentation for fourflusher-0.3.2

Parsing documentation for escape-0.0.4

Installing ri documentation for escape-0.0.4

Parsing documentation for colored-1.2

Installing ri documentation for colored-1.2

Parsing documentation for concurrent-ruby-1.0.2

Installing ri documentation for concurrent-ruby-1.0.2

Parsing documentation for thread_safe-0.3.5

Installing ri documentation for thread_safe-0.3.5

Parsing documentation for tzinfo-1.2.2

Installing ri documentation for tzinfo-1.2.2

Parsing documentation for i18n-0.7.0

Installing ri documentation for i18n-0.7.0

Parsing documentation for activesupport-5.0.0

Installing ri documentation for activesupport-5.0.0

Parsing documentation for claide-1.0.0

Installing ri documentation for claide-1.0.0

Parsing documentation for xcodeproj-1.1.0

Installing ri documentation for xcodeproj-1.1.0

Parsing documentation for molinillo-0.4.5

Installing ri documentation for molinillo-0.4.5

Parsing documentation for cocoapods-try-1.0.0

Installing ri documentation for cocoapods-try-1.0.0

Parsing documentation for netrc-0.7.8

Installing ri documentation for netrc-0.7.8

Parsing documentation for cocoapods-trunk-1.0.0

Installing ri documentation for cocoapods-trunk-1.0.0

Parsing documentation for cocoapods-stats-1.0.0

Installing ri documentation for cocoapods-stats-1.0.0

Parsing documentation for cocoapods-search-1.0.0

Installing ri documentation for cocoapods-search-1.0.0

Parsing documentation for cocoapods-plugins-1.0.0

Installing ri documentation for cocoapods-plugins-1.0.0

Parsing documentation for cocoapods-downloader-1.0.1

Installing ri documentation for cocoapods-downloader-1.0.1

Parsing documentation for cocoapods-deintegrate-1.0.0

Installing ri documentation for cocoapods-deintegrate-1.0.0

Parsing documentation for fuzzy_match-2.0.4

Installing ri documentation for fuzzy_match-2.0.4

Parsing documentation for cocoapods-core-1.0.1

Installing ri documentation for cocoapods-core-1.0.1

Parsing documentation for cocoapods-1.0.1

Installing ri documentation for cocoapods-1.0.1

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 146 seconds

23 gems installed

升级ruby后再安装cocodPod的更多相关文章

  1. 安装了VS2010 sp1 后再安装ASP.NET MVC 3.0的问题

    安装了VS2010 sp1 后再安装ASP.NET MVC 3.0的问题(Final Result: Installation failed with error code: (0x80070643) ...

  2. CentOS 6,7最小化安装后再安装图形界面

    CentOS 6.2最小化安装后再安装图形界面 在安装CentOS 6.2时发现它没有提示我要怎么安装,而是“自作主张”地给我选择了最小化安装,结果装完之后只有终端界面,因为有时候不得不用图形界面,所 ...

  3. 安装了VS2010 sp1 后再安装ASP.NET MVC 3.0的问题(Final Result: Installation failed with error code: (0x80070643), "安装时发生严重错误 " (Ela)

    原文:安装了VS2010 sp1 后再安装ASP.NET MVC 3.0的问题(Final Result: Installation failed with error code: (0x800706 ...

  4. 卸载mysql后再安装提示The service already exists!问题解决方法

    卸载mysql后再安装输入mysqld --install 回车后提示The service already exists! 原因:卸载的时候没有卸载干净 方法: 一.重新以管理员身份打开cmd 二. ...

  5. ubuntu将python3设为默认后再安装支持python3.x的包

    简介: ubuntu默认python2.7版本,如果想要装python3.x版本,请记住python2.7版本一定不能卸载!!!但是即使我 python3.x版本安装成功,当运行python脚本时,系 ...

  6. 【JDK】JDK7与JDK8环境共存与切换:先安装jdk7,配置好环境变量后再安装jdk8

    1.先安装JDK7 下载jdk-7u79-windows-i586.exe,安装后配置好环境变量JAVA_HOME,CLASSPATH,PATH java -version javac 指令都正常 2 ...

  7. 安装了ruby后怎么安装sass

    在命令行中输入 ruby -v 查看版本号 先移除默认的https://rubygems.org源,命令为gem sources --remove https://rubygems.org/,按回车 ...

  8. linux yum下载RPM包后再安装LAMP环境

    1.下载yum插件 yum-downloadonly,实现只下载软件包的功能. yum install yum-downloadonly 或者 yum install yum install yum- ...

  9. 完成卸载vs2010后再安装

    在安装好vs2010后,更改了驱动器号,造成vs工具不能使用,所以需要卸载vs2010 使用Microsoft Visual Studio 2010 Uninstall Utility来卸载vs201 ...

随机推荐

  1. 16.10.16学到的JAVA知识

    1. 每个字节就是八位,所以每个字节的取值范围是  -128~127,它可以保存一个英文字符,包括字母,数字和英文标点.而汉字的的数量很多,一个字节没法把所有的汉字表达出来,所以汉字就是用两个字节来存 ...

  2. AppScan 测试需要输入用户名密码的网站

    Cisco有专门的网页版的AppScan,使用前需要向有关的team申请account和权限. account和权限申请成功后,登录AppScan网站,创建自己的文件夹目录,然后在自己的目录下新建sc ...

  3. DQL、DML、DDL、DCL的概念与区别

    SQL(Structure Query Language)语言是数据库的核心语言. SQL的发展是从1974年开始的,其发展过程如下:1974年-----由Boyce和Chamberlin提出,当时称 ...

  4. 2-4. Using auto with Functions

    在C++14中允许使用type deduction用于函数参数和函数返回值 Return Type Deduction in C++11 #include <iostream> using ...

  5. python安装使用talib

    安装主要在http://www.lfd.uci.edu/~gohlke/pythonlibs/这个网站找到 按照需要的python版本和平台位数下载,然后直接用pip install 进行安装 包含的 ...

  6. verilog循环结构

    1. always(posedge CLOCK) . case(i) . . : . ) ’d0; i <= i + ’b1; end . ’b1; C1 <= C1 + ’b1; end ...

  7. Android数据库加密之sqlciher方案

    版权声明:本文为博主原创文章,未经博主允许不得转载. 转载请表明出处:http://www.cnblogs.com/cavalier-/p/6241964.html 前言 大家好,我是Cavalier ...

  8. nginx url 重写

    rewrite ^([^\.]*)/platform/(.+)/(.+)-(.+)\.html$ $1/platform.php?mod=asklist&ym=$2&fl=$3& ...

  9. JAVA获取服务器路径的方法

    1.在JSF环境中获取到ServletContext: 1 2 ServletContext sc = (ServletContext)FacesContext.         getCurrent ...

  10. 解决mac安装grunt时出现[command not found]的错误

    第一步: 1先确定一下.bash_profile是否存在. 2在mac终端输入: test -e .bash_profile && echo "found" || ...