Cocoapods

關(guān)于安裝cocoapods遇到的一些坑(ERROR: Error installing cocoapods: activesupport requires Ruby version >= 2.2)

1.移除現(xiàn)有的Ruby

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

2.使用淘寶鏡像

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

3.驗(yàn)證當(dāng)前ruby版本

$gem sources -l

成功后提示:

*** CURRENT SOURCES ***

https://ruby.taobao.org/

4.開始安裝cocoapods

$sudo gem install cocoapods

這時(shí)候提示:

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.

這個(gè)地方很坑地粪,之前安裝cocoapods一直是沒有這個(gè)問(wèn)題的,這里提示Ruby版本要大于或等于2.2.2

于是查看ruby版本

$ruby -v

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

果然這里就要升級(jí)Ruby版本啦

查看目前的所有ruby版本:

$rvm list known

如果提示command not found 請(qǐng)先安裝rvm

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

如果已安裝會(huì)列出所有的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- --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

終端運(yùn)行結(jié)果:(如果直接成功請(qǐng)繞過(guò)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.

這里執(zhí)行:

$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

再執(zhí)行:

$ 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就安裝好了

現(xiàn)在就可以安裝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

關(guān)于cocoapods的用法就不再多說(shuō)了琐谤,有很多蟆技。這里是總結(jié)了本人安裝cocoapods里遇到的坑以及解決辦法,希望能有所幫助斗忌。

最后編輯于
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請(qǐng)聯(lián)系作者
  • 序言:七十年代末质礼,一起剝皮案震驚了整個(gè)濱河市,隨后出現(xiàn)的幾起案子飞蹂,更是在濱河造成了極大的恐慌几苍,老刑警劉巖,帶你破解...
    沈念sama閱讀 221,888評(píng)論 6 515
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件陈哑,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡伸眶,警方通過(guò)查閱死者的電腦和手機(jī)惊窖,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 94,677評(píng)論 3 399
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)厘贼,“玉大人界酒,你說(shuō)我怎么就攤上這事∽旖眨” “怎么了毁欣?”我有些...
    開封第一講書人閱讀 168,386評(píng)論 0 360
  • 文/不壞的土叔 我叫張陵庇谆,是天一觀的道長(zhǎng)。 經(jīng)常有香客問(wèn)我凭疮,道長(zhǎng)饭耳,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 59,726評(píng)論 1 297
  • 正文 為了忘掉前任执解,我火速辦了婚禮寞肖,結(jié)果婚禮上,老公的妹妹穿的比我還像新娘衰腌。我一直安慰自己新蟆,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 68,729評(píng)論 6 397
  • 文/花漫 我一把揭開白布右蕊。 她就那樣靜靜地躺著琼稻,像睡著了一般。 火紅的嫁衣襯著肌膚如雪饶囚。 梳的紋絲不亂的頭發(fā)上欣簇,一...
    開封第一講書人閱讀 52,337評(píng)論 1 310
  • 那天,我揣著相機(jī)與錄音坯约,去河邊找鬼熊咽。 笑死,一個(gè)胖子當(dāng)著我的面吹牛闹丐,可吹牛的內(nèi)容都是我干的横殴。 我是一名探鬼主播,決...
    沈念sama閱讀 40,902評(píng)論 3 421
  • 文/蒼蘭香墨 我猛地睜開眼卿拴,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼衫仑!你這毒婦竟也來(lái)了?” 一聲冷哼從身側(cè)響起堕花,我...
    開封第一講書人閱讀 39,807評(píng)論 0 276
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤文狱,失蹤者是張志新(化名)和其女友劉穎,沒想到半個(gè)月后缘挽,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體瞄崇,經(jīng)...
    沈念sama閱讀 46,349評(píng)論 1 318
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 38,439評(píng)論 3 340
  • 正文 我和宋清朗相戀三年壕曼,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了苏研。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片。...
    茶點(diǎn)故事閱讀 40,567評(píng)論 1 352
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡腮郊,死狀恐怖摹蘑,靈堂內(nèi)的尸體忽然破棺而出,到底是詐尸還是另有隱情轧飞,我是刑警寧澤衅鹿,帶...
    沈念sama閱讀 36,242評(píng)論 5 350
  • 正文 年R本政府宣布撒踪,位于F島的核電站,受9級(jí)特大地震影響大渤,放射性物質(zhì)發(fā)生泄漏制妄。R本人自食惡果不足惜,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 41,933評(píng)論 3 334
  • 文/蒙蒙 一兼犯、第九天 我趴在偏房一處隱蔽的房頂上張望忍捡。 院中可真熱鬧,春花似錦切黔、人聲如沸砸脊。這莊子的主人今日做“春日...
    開封第一講書人閱讀 32,420評(píng)論 0 24
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)凌埂。三九已至,卻和暖如春诗芜,著一層夾襖步出監(jiān)牢的瞬間瞳抓,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 33,531評(píng)論 1 272
  • 我被黑心中介騙來(lái)泰國(guó)打工伏恐, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留孩哑,地道東北人。 一個(gè)月前我還...
    沈念sama閱讀 48,995評(píng)論 3 377
  • 正文 我出身青樓翠桦,卻偏偏與公主長(zhǎng)得像横蜒,于是被迫代替她去往敵國(guó)和親。 傳聞我的和親對(duì)象是個(gè)殘疾皇子销凑,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 45,585評(píng)論 2 359

推薦閱讀更多精彩內(nèi)容