CocoaPods安裝教程

1.CocoaPods的安裝,首先要安裝好Ruby。

2.Ruby的安裝

2.1在終端輸入(要等一段時間)

curl-L https://get.rvm.io | bash -s stable

然后輸入

source~/.rvm/scripts/rvm

輸入(檢查版本)

rvm-v

如何有返回

rvm1.29.3(latest)byMichalPapis,PiotrKuczynski,WayneE.Seguin[https://rvm.io]

說明安裝RVM成功

輸入(更新RVM)

rvmgetstable

3.安裝Ruby

在終端輸入?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[.10][ruby-]2.2[.7][ruby-]2.3[.4][ruby-]2.4[.1]ruby-head# for forks use: rvm install ruby-head- --url https://github.com/github/ruby.git --branch2.2# JRubyjruby-1.6[.8]jruby-1.7[.27]jruby[-9.1.13.0]jruby-head# Rubiniusrbx-1[.4.3]rbx-2.3[.0]rbx-2.4[.1]rbx-2[.5.8]rbx-3[.84]rbx-head# Opalopal# Minimalistic ruby implementation - ISO30170:2012mruby-1.0.0mruby-1.1.0mruby-1.2.0mruby-1[.3.0]mruby[-head]# Ruby Enterprise Editionree-1.8.6ree[-1.8.7][-2012.02]# Topaztopaz# MagLevmaglev[-head]maglev-1.0.0# Mac OS X Snow Leopard Or Newermacruby-0.10macruby-0.11macruby[-0.12]macruby-nightlymacruby-head# IronRubyironruby[-1.1.3]ironruby-headLvXinJiMac:~ lvxinji$

3.2 挑一個安裝

終端輸入?rvm install 2.4.0

如果報錯:


則需要先在終端輸入 :rvm autolibs disable 再輸入?rvm install 2.4.0 就沒事了,沒有報錯就忽略這個。

安裝成功

Searchingforbinary rubies, this might take some time.No binary rubies availablefor:osx/10.13/x86_64/ruby-2.4.0.Continuing with compilation. Please read'rvm help mount'to get more information on binary rubies.Installing Ruby from sourceto:/Users/lvxinji/.rvm/rubies/ruby-2.4.0, this may take awhiledepending on your cpu(s)...ruby-2.4.0-#downloading ruby-2.4.0, this may take a while depending on your connection...% Total? ? % Received % Xferd? Average Speed? Time? ? Time? ? Time? Current? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Dload? Upload? Total? Spent? ? Left? Speed10011.9M10011.9M001701k00:00:070:00:07--:--:--1753kruby-2.4.0-#extracting ruby-2.4.0to /Users/lvxinji/.rvm/src/ruby-2.4.0....ruby-2.4.0-#applying patch /Users/lvxinji/.rvm/patches/ruby/2.4.0/ruby_2_4_gcc7.patch.ruby-2.4.0-#applying patch /Users/lvxinji/.rvm/patches/ruby/2.4.0/random_c_using_NR_prefix.patch.ruby-2.4.0-#configuring..........................................................-ruby-2.4.0-#post-configuration.ruby-2.4.0-#compiling.............................................................ruby-2.4.0-#installing.......ruby-2.4.0-#making binaries executable..ruby-2.4.0-#downloading rubygems-2.6.14% Total? ? % Received % Xferd? Average Speed? Time? ? Time? ? Time? Current? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? Dload? Upload? Total? Spent? ? Left? Speed100751k100751k001975500:00:380:00:38--:--:--47500No checksumfordownloaded archive, recording checksuminuser configuration.ruby-2.4.0-#extracting rubygems-2.6.14....ruby-2.4.0-#removing old rubygems.........ruby-2.4.0-#installing rubygems-2.6.14...........................ruby-2.4.0-#gemset created /Users/lvxinji/.rvm/gems/ruby-2.4.0@globalruby-2.4.0-#importing gemset /Users/lvxinji/.rvm/gemsets/global.gems.............there was an error installing gem rubygems-bundler.....................ruby-2.4.0-#generating global wrappers........ruby-2.4.0-#gemset created /Users/lvxinji/.rvm/gems/ruby-2.4.0ruby-2.4.0-#importing gemsetfile /Users/lvxinji/.rvm/gemsets/default.gems evaluated to empty gem listruby-2.4.0-#generating default wrappers........ruby-2.4.0-#adjusting #shebangs for (gem irb erb ri rdoc testrb rake).Install of ruby-2.4.0-#completePlease be aware that you just installed a ruby that requires2patches just to be compiled on an up to date linux system.This may have knownandunaccountedforsecurity vulnerabilities.Please consider upgrading to ruby-2.4.1which will have all of the latest security patches.Ruby was built without documentation, to build itrun:rvm docs generate-ri

設置默認版本 ?rvm use 2.4.0 --default

到這里Ruby環境安裝就結束了。

4.安裝CocoaPods

本來是直接在終端敲入以下代碼就可以,因為有墻,所以需要使用淘寶鏡像。

sudogem install cocoapods

在終端輸入

gem sources --removehttps://rubygems.org/

接著輸入

gem sources -ahttps://ruby.taobao.org/

如果報錯:


則換另一種方法:

在終端輸入:$gem source -a http://rubygems.org/ to read

會跳出什么DO YOU Want.... 輸入y。

然后?輸入gem source -a http://rubygems.org/ to read

輸入開機密碼,就成功了。

Fetching:concurrent-ruby-1.0.5.gem(100%)Successfullyinstalledconcurrent-ruby-1.0.5Fetching:i18n-0.9.0.gem(100%)Successfullyinstalledi18n-0.9.0Fetching:thread_safe-0.3.6.gem(100%)Successfullyinstalledthread_safe-0.3.6Fetching:tzinfo-1.2.3.gem(100%)Successfullyinstalledtzinfo-1.2.3Fetching:activesupport-4.2.10.gem(100%)Successfullyinstalledactivesupport-4.2.10Fetching:nap-1.1.0.gem(100%)Successfullyinstallednap-1.1.0Fetching:fuzzy_match-2.0.4.gem(100%)Successfullyinstalledfuzzy_match-2.0.4Fetching:cocoapods-core-1.4.0.beta.1.gem(100%)Successfullyinstalledcocoapods-core-1.4.0.beta.1Fetching:claide-1.0.2.gem(100%)Successfullyinstalledclaide-1.0.2Fetching:cocoapods-deintegrate-1.0.1.gem(100%)Successfullyinstalledcocoapods-deintegrate-1.0.1Fetching:cocoapods-downloader-1.1.3.gem(100%)Successfullyinstalledcocoapods-downloader-1.1.3Fetching:cocoapods-plugins-1.0.0.gem(100%)Successfullyinstalledcocoapods-plugins-1.0.0Fetching:cocoapods-search-1.0.0.gem(100%)Successfullyinstalledcocoapods-search-1.0.0Fetching:cocoapods-stats-1.0.0.gem(100%)Successfullyinstalledcocoapods-stats-1.0.0Fetching:netrc-0.11.0.gem(100%)Successfullyinstallednetrc-0.11.0Fetching:cocoapods-trunk-1.3.0.gem(100%)Successfullyinstalledcocoapods-trunk-1.3.0Fetching:cocoapods-try-1.1.0.gem(100%)Successfullyinstalledcocoapods-try-1.1.0Fetching:molinillo-0.6.3.gem(100%)Successfullyinstalledmolinillo-0.6.3Fetching:CFPropertyList-2.3.5.gem(100%)SuccessfullyinstalledCFPropertyList-2.3.5Fetching:colored2-3.1.2.gem(100%)Successfullyinstalledcolored2-3.1.2Fetching:nanaimo-0.2.3.gem(100%)Successfullyinstallednanaimo-0.2.3Fetching:xcodeproj-1.5.2.gem(100%)Successfullyinstalledxcodeproj-1.5.2Fetching:escape-0.0.4.gem(100%)Successfullyinstalledescape-0.0.4Fetching:fourflusher-2.0.1.gem(100%)Successfullyinstalledfourflusher-2.0.1Fetching:gh_inspector-1.0.3.gem(100%)Successfullyinstalledgh_inspector-1.0.3Fetching:ruby-macho-1.1.0.gem(100%)Successfullyinstalledruby-macho-1.1.0Fetching:cocoapods-1.4.0.beta.1.gem(100%)Successfullyinstalledcocoapods-1.4.0.beta.1Parsingdocumentationforconcurrent-ruby-1.0.5Installingridocumentationforconcurrent-ruby-1.0.5Parsingdocumentationfori18n-0.9.0Installingridocumentationfori18n-0.9.0Parsingdocumentationforthread_safe-0.3.6Installingridocumentationforthread_safe-0.3.6Parsingdocumentationfortzinfo-1.2.3Installingridocumentationfortzinfo-1.2.3Parsingdocumentationforactivesupport-4.2.10Installingridocumentationforactivesupport-4.2.10Parsingdocumentationfornap-1.1.0Installingridocumentationfornap-1.1.0Parsingdocumentationforfuzzy_match-2.0.4Installingridocumentationforfuzzy_match-2.0.4Parsingdocumentationforcocoapods-core-1.4.0.beta.1Installingridocumentationforcocoapods-core-1.4.0.beta.1Parsingdocumentationforclaide-1.0.2Installingridocumentationforclaide-1.0.2Parsingdocumentationforcocoapods-deintegrate-1.0.1Installingridocumentationforcocoapods-deintegrate-1.0.1Parsingdocumentationforcocoapods-downloader-1.1.3Installingridocumentationforcocoapods-downloader-1.1.3Parsingdocumentationforcocoapods-plugins-1.0.0Installingridocumentationforcocoapods-plugins-1.0.0Parsingdocumentationforcocoapods-search-1.0.0Installingridocumentationforcocoapods-search-1.0.0Parsingdocumentationforcocoapods-stats-1.0.0Installingridocumentationforcocoapods-stats-1.0.0Parsingdocumentationfornetrc-0.11.0Installingridocumentationfornetrc-0.11.0Parsingdocumentationforcocoapods-trunk-1.3.0Installingridocumentationforcocoapods-trunk-1.3.0Parsingdocumentationforcocoapods-try-1.1.0Installingridocumentationforcocoapods-try-1.1.0Parsingdocumentationformolinillo-0.6.3Installingridocumentationformolinillo-0.6.3ParsingdocumentationforCFPropertyList-2.3.5InstallingridocumentationforCFPropertyList-2.3.5Parsingdocumentationforcolored2-3.1.2Installingridocumentationforcolored2-3.1.2Parsingdocumentationfornanaimo-0.2.3Installingridocumentationfornanaimo-0.2.3Parsingdocumentationforxcodeproj-1.5.2Installingridocumentationforxcodeproj-1.5.2Parsingdocumentationforescape-0.0.4Installingridocumentationforescape-0.0.4Parsingdocumentationforfourflusher-2.0.1Installingridocumentationforfourflusher-2.0.1Parsingdocumentationforgh_inspector-1.0.3Installingridocumentationforgh_inspector-1.0.3Parsingdocumentationforruby-macho-1.1.0Installingridocumentationforruby-macho-1.1.0Parsingdocumentationforcocoapods-1.4.0.beta.1Installingridocumentationforcocoapods-1.4.0.beta.1Doneinstallingdocumentationforconcurrent-ruby,i18n,thread_safe,tzinfo,activesupport,nap,fuzzy_match,cocoapods-core,claide,cocoapods-deintegrate,cocoapods-downloader,cocoapods-plugins,cocoapods-search,cocoapods-stats,netrc,cocoapods-trunk,cocoapods-try,molinillo,CFPropertyList,colored2,nanaimo,xcodeproj,escape,fourflusher,gh_inspector,ruby-macho,cocoapodsafter23seconds27gemsinstalled

?著作權歸作者所有,轉載或內容合作請聯系作者
平臺聲明:文章內容(如有圖片或視頻亦包括在內)由作者上傳并發布,文章內容僅代表作者本人觀點,簡書系信息發布平臺,僅提供信息存儲服務。
  • 序言:七十年代末,一起剝皮案震驚了整個濱河市,隨后出現的幾起案子,更是在濱河造成了極大的恐慌,老刑警劉巖,帶你破解...
    沈念sama閱讀 228,786評論 6 534
  • 序言:濱河連續發生了三起死亡事件,死亡現場離奇詭異,居然都是意外死亡,警方通過查閱死者的電腦和手機,發現死者居然都...
    沈念sama閱讀 98,656評論 3 419
  • 文/潘曉璐 我一進店門,熙熙樓的掌柜王于貴愁眉苦臉地迎上來,“玉大人,你說我怎么就攤上這事。” “怎么了?”我有些...
    開封第一講書人閱讀 176,697評論 0 379
  • 文/不壞的土叔 我叫張陵,是天一觀的道長。 經常有香客問我,道長,這世上最難降的妖魔是什么? 我笑而不...
    開封第一講書人閱讀 63,098評論 1 314
  • 正文 為了忘掉前任,我火速辦了婚禮,結果婚禮上,老公的妹妹穿的比我還像新娘。我一直安慰自己,他們只是感情好,可當我...
    茶點故事閱讀 71,855評論 6 410
  • 文/花漫 我一把揭開白布。 她就那樣靜靜地躺著,像睡著了一般。 火紅的嫁衣襯著肌膚如雪。 梳的紋絲不亂的頭發上,一...
    開封第一講書人閱讀 55,254評論 1 324
  • 那天,我揣著相機與錄音,去河邊找鬼。 笑死,一個胖子當著我的面吹牛,可吹牛的內容都是我干的。 我是一名探鬼主播,決...
    沈念sama閱讀 43,322評論 3 442
  • 文/蒼蘭香墨 我猛地睜開眼,長吁一口氣:“原來是場噩夢啊……” “哼!你這毒婦竟也來了?” 一聲冷哼從身側響起,我...
    開封第一講書人閱讀 42,473評論 0 289
  • 序言:老撾萬榮一對情侶失蹤,失蹤者是張志新(化名)和其女友劉穎,沒想到半個月后,有當地人在樹林里發現了一具尸體,經...
    沈念sama閱讀 49,014評論 1 335
  • 正文 獨居荒郊野嶺守林人離奇死亡,尸身上長有42處帶血的膿包…… 初始之章·張勛 以下內容為張勛視角 年9月15日...
    茶點故事閱讀 40,833評論 3 355
  • 正文 我和宋清朗相戀三年,在試婚紗的時候發現自己被綠了。 大學時的朋友給我發了我未婚夫和他白月光在一起吃飯的照片。...
    茶點故事閱讀 43,016評論 1 371
  • 序言:一個原本活蹦亂跳的男人離奇死亡,死狀恐怖,靈堂內的尸體忽然破棺而出,到底是詐尸還是另有隱情,我是刑警寧澤,帶...
    沈念sama閱讀 38,568評論 5 362
  • 正文 年R本政府宣布,位于F島的核電站,受9級特大地震影響,放射性物質發生泄漏。R本人自食惡果不足惜,卻給世界環境...
    茶點故事閱讀 44,273評論 3 347
  • 文/蒙蒙 一、第九天 我趴在偏房一處隱蔽的房頂上張望。 院中可真熱鬧,春花似錦、人聲如沸。這莊子的主人今日做“春日...
    開封第一講書人閱讀 34,680評論 0 26
  • 文/蒼蘭香墨 我抬頭看了看天上的太陽。三九已至,卻和暖如春,著一層夾襖步出監牢的瞬間,已是汗流浹背。 一陣腳步聲響...
    開封第一講書人閱讀 35,946評論 1 288
  • 我被黑心中介騙來泰國打工, 沒想到剛下飛機就差點兒被人妖公主榨干…… 1. 我叫王不留,地道東北人。 一個月前我還...
    沈念sama閱讀 51,730評論 3 393
  • 正文 我出身青樓,卻偏偏與公主長得像,于是被迫代替她去往敵國和親。 傳聞我的和親對象是個殘疾皇子,可洞房花燭夜當晚...
    茶點故事閱讀 48,006評論 2 374

推薦閱讀更多精彩內容