iOS 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-<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
終端運(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閱讀 212,816評(píng)論 6 492
  • 序言:濱河連續(xù)發(fā)生了三起死亡事件售睹,死亡現(xiàn)場(chǎng)離奇詭異,居然都是意外死亡可训,警方通過(guò)查閱死者的電腦和手機(jī)昌妹,發(fā)現(xiàn)死者居然都...
    沈念sama閱讀 90,729評(píng)論 3 385
  • 文/潘曉璐 我一進(jìn)店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來(lái)握截,“玉大人飞崖,你說(shuō)我怎么就攤上這事〗靼” “怎么了固歪?”我有些...
    開封第一講書人閱讀 158,300評(píng)論 0 348
  • 文/不壞的土叔 我叫張陵,是天一觀的道長(zhǎng)胯努。 經(jīng)常有香客問(wèn)我牢裳,道長(zhǎng),這世上最難降的妖魔是什么叶沛? 我笑而不...
    開封第一講書人閱讀 56,780評(píng)論 1 285
  • 正文 為了忘掉前任蒲讯,我火速辦了婚禮,結(jié)果婚禮上灰署,老公的妹妹穿的比我還像新娘判帮。我一直安慰自己局嘁,他們只是感情好,可當(dāng)我...
    茶點(diǎn)故事閱讀 65,890評(píng)論 6 385
  • 文/花漫 我一把揭開白布晦墙。 她就那樣靜靜地躺著悦昵,像睡著了一般。 火紅的嫁衣襯著肌膚如雪晌畅。 梳的紋絲不亂的頭發(fā)上但指,一...
    開封第一講書人閱讀 50,084評(píng)論 1 291
  • 那天,我揣著相機(jī)與錄音踩麦,去河邊找鬼枚赡。 笑死氓癌,一個(gè)胖子當(dāng)著我的面吹牛谓谦,可吹牛的內(nèi)容都是我干的。 我是一名探鬼主播贪婉,決...
    沈念sama閱讀 39,151評(píng)論 3 410
  • 文/蒼蘭香墨 我猛地睜開眼反粥,長(zhǎng)吁一口氣:“原來(lái)是場(chǎng)噩夢(mèng)啊……” “哼!你這毒婦竟也來(lái)了疲迂?” 一聲冷哼從身側(cè)響起才顿,我...
    開封第一講書人閱讀 37,912評(píng)論 0 268
  • 序言:老撾萬(wàn)榮一對(duì)情侶失蹤,失蹤者是張志新(化名)和其女友劉穎尤蒿,沒想到半個(gè)月后郑气,有當(dāng)?shù)厝嗽跇淞掷锇l(fā)現(xiàn)了一具尸體,經(jīng)...
    沈念sama閱讀 44,355評(píng)論 1 303
  • 正文 獨(dú)居荒郊野嶺守林人離奇死亡腰池,尸身上長(zhǎng)有42處帶血的膿包…… 初始之章·張勛 以下內(nèi)容為張勛視角 年9月15日...
    茶點(diǎn)故事閱讀 36,666評(píng)論 2 327
  • 正文 我和宋清朗相戀三年尾组,在試婚紗的時(shí)候發(fā)現(xiàn)自己被綠了。 大學(xué)時(shí)的朋友給我發(fā)了我未婚夫和他白月光在一起吃飯的照片示弓。...
    茶點(diǎn)故事閱讀 38,809評(píng)論 1 341
  • 序言:一個(gè)原本活蹦亂跳的男人離奇死亡讳侨,死狀恐怖,靈堂內(nèi)的尸體忽然破棺而出奏属,到底是詐尸還是另有隱情跨跨,我是刑警寧澤,帶...
    沈念sama閱讀 34,504評(píng)論 4 334
  • 正文 年R本政府宣布囱皿,位于F島的核電站勇婴,受9級(jí)特大地震影響,放射性物質(zhì)發(fā)生泄漏嘱腥。R本人自食惡果不足惜咆耿,卻給世界環(huán)境...
    茶點(diǎn)故事閱讀 40,150評(píng)論 3 317
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望爹橱。 院中可真熱鬧萨螺,春花似錦窄做、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 30,882評(píng)論 0 21
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽(yáng)。三九已至吻商,卻和暖如春掏颊,著一層夾襖步出監(jiān)牢的瞬間,已是汗流浹背艾帐。 一陣腳步聲響...
    開封第一講書人閱讀 32,121評(píng)論 1 267
  • 我被黑心中介騙來(lái)泰國(guó)打工乌叶, 沒想到剛下飛機(jī)就差點(diǎn)兒被人妖公主榨干…… 1. 我叫王不留,地道東北人柒爸。 一個(gè)月前我還...
    沈念sama閱讀 46,628評(píng)論 2 362
  • 正文 我出身青樓准浴,卻偏偏與公主長(zhǎng)得像,于是被迫代替她去往敵國(guó)和親捎稚。 傳聞我的和親對(duì)象是個(gè)殘疾皇子乐横,可洞房花燭夜當(dāng)晚...
    茶點(diǎn)故事閱讀 43,724評(píng)論 2 351

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