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