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阅读 206,214评论 6 481
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 88,307评论 2 382
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 152,543评论 0 341
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 55,221评论 1 279
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 64,224评论 5 371
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,007评论 1 284
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 38,313评论 3 399
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 36,956评论 0 259
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 43,441评论 1 300
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 35,925评论 2 323
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,018评论 1 333
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 33,685评论 4 322
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,234评论 3 307
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,240评论 0 19
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 31,464评论 1 261
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 45,467评论 2 352
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 42,762评论 2 345

推荐阅读更多精彩内容