macOS Sierra 10.12.1 (Xcode8.1)
2016-11-27 本文已影响2154人
J_mailbox
history.png
16. 解决Unable to find a pod with name, author, summary, or description matching
近期由于公司电脑磁盘频繁提示磁盘空间不足,每次看到都是临时删除一些文件腾出空间,但时间不长又会提示磁盘不足,又懒得对电脑文件一一整理归纳,所以最后决定格式化磁盘,重新安装系统,想到在线安装由于网速比较慢且浪费时间于是提前下载好镜像,使用U盘安装,考虑到怕耽误工作进度,于是将开发所必须用到的工具都一一提前下载好,想着待电脑重装完系统之后便可以对其一一安装,没想到期间还是遇到了一些坑,那就是最后准备运行代码更新cocoapods更新依赖库的时候出现了问题,最后导致花了差不多一中午的时间再折腾这个事情,特此记录一下。
问题原因:
由于macOS Sierra 10.12.1 自带ruby版本(2.0.0)过低,导致安装cocoapods的时候出了各种问题,由于我个人电脑和公司电脑都碰到这个问题,所以下面将介绍两种安装ruby的方式:
解决方式:
- rvm(Ruby Version Manager) 不仅可以用来安装ruby,还可以对不同的ruby版本进行管理的工具。
- rbenv (Ruby environment) 同样提供了对ruby版本进行管理的功能,两者都能实现对ruby的管理,就安装ruby来看这两款管理工具操作起来都很简单,只需一些简单的命令行即可完成对ruby的安装与管理。
一、rvm 安装ruby
1. 查看当前ruby版本:
MacdeMacBook-Pro:~ mac$ ruby -v
ruby 2.0.0p648 (2015-12-16 revision 53162) [universal.x86_64-darwin16]
2. 安装rvm管理工具:
MacdeMacBook-Pro:~ mac$ curl -L https://get.rvm.io | bash -s stable
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 184 100 184 0 0 99 0 0:00:01 0:00:01 --:--:-- 99
100 22921 100 22921 0 0 3972 0 0:00:05 0:00:05 --:--:-- 6052
Downloading https://github.com/rvm/rvm/archive/1.27.0.tar.gz
Downloading https://github.com/rvm/rvm/releases/download/1.27.0/1.27.0.tar.gz.asc
curl: (28) Connection timed out after 30005 milliseconds
Could not download 'https://github.com/rvm/rvm/releases/download/1.27.0/1.27.0.tar.gz.asc'.
curl returned status '28'.
Installing RVM to /Users/mac/.rvm/
Adding rvm PATH line to /Users/mac/.profile /Users/mac/.mkshrc /Users/mac/.bashrc /Users/mac/.zshrc.
Adding rvm loading line to /Users/mac/.profile /Users/mac/.bash_profile /Users/mac/.zlogin.
Installation of RVM in /Users/mac/.rvm/ is almost complete:
* To start using RVM you need to run `source /Users/mac/.rvm/scripts/rvm`
in all your open shell windows, in rare cases you need to reopen all shell windows.
# mac,
#
# Thank you for using RVM!
# We sincerely hope that RVM helps to make your life easier and more enjoyable!!!
#
# ~Wayne, Michal & team.
In case of problems: https://rvm.io/help and https://twitter.com/rvm_io
MacdeMacBook-Pro:~ mac$
3. 检查rvm版本:
MacdeMacBook-Pro:~ mac$ rvm -v
rvm 1.27.0 (latest) by Wayne E. Seguin <wayneeseguin@gmail.com>, Michal Papis <mpapis@gmail.com> [https://rvm.io/]
MacdeMacBook-Pro:~ mac$
4. 查出所有可用ruby版本:
MacdeMacBook-Pro:~ mac$ 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[.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
MacdeMacBook-Pro:~ mac$
5. 安装ruby 2.3.0版本:
MacdeMacBook-Pro:~ mac$ rvm install 2.3.0
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.12/x86_64/ruby-2.3.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
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/share/doc/homebrew
/usr/local/share/man/man1/brew.1
/usr/local/share/zsh/site-functions/_brew
/usr/local/etc/bash_completion.d/brew
/usr/local/Homebrew
==> The following new directories will be created:
/usr/local/Cellar
/usr/local/Homebrew
/usr/local/Frameworks
/usr/local/bin
/usr/local/etc
/usr/local/include
/usr/local/lib
/usr/local/opt
/usr/local/sbin
/usr/local/share
/usr/local/share/zsh
/usr/local/share/zsh/site-functions
/usr/local/var
Press RETURN to continue or any other key to abort
==> /usr/bin/sudo /bin/mkdir -p /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
Password:
==> /usr/bin/sudo /bin/chmod g+rwx /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/chmod 755 /usr/local/share/zsh /usr/local/share/zsh/site-functions
==> /usr/bin/sudo /usr/sbin/chown mac /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /usr/bin/chgrp admin /usr/local/Cellar /usr/local/Homebrew /usr/local/Frameworks /usr/local/bin /usr/local/etc /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin /usr/local/share /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var
==> /usr/bin/sudo /bin/mkdir -p /Users/mac/Library/Caches/Homebrew
==> /usr/bin/sudo /bin/chmod g+rwx /Users/mac/Library/Caches/Homebrew
==> /usr/bin/sudo /usr/sbin/chown mac /Users/mac/Library/Caches/Homebrew
==> Downloading and installing Homebrew...
remote: Counting objects: 4131, done.
remote: Compressing objects: 100% (2754/2754), done.
remote: Total 4131 (delta 2094), reused 2652 (delta 1230), pack-reused 0
Receiving objects: 100% (4131/4131), 2.40 MiB | 49.00 KiB/s, done.
Resolving deltas: 100% (2094/2094), done.
From https://github.com/Homebrew/brew
* [new branch] master -> origin/master
* [new tag] 0.1 -> 0.1
* [new tag] 0.2 -> 0.2
* [new tag] 0.3 -> 0.3
* [new tag] 0.4 -> 0.4
* [new tag] 0.5 -> 0.5
* [new tag] 0.6 -> 0.6
* [new tag] 0.7 -> 0.7
* [new tag] 0.7.1 -> 0.7.1
* [new tag] 0.8 -> 0.8
* [new tag] 0.8.1 -> 0.8.1
* [new tag] 0.9 -> 0.9
* [new tag] 0.9.1 -> 0.9.1
* [new tag] 0.9.2 -> 0.9.2
* [new tag] 0.9.3 -> 0.9.3
* [new tag] 0.9.4 -> 0.9.4
* [new tag] 0.9.5 -> 0.9.5
* [new tag] 0.9.8 -> 0.9.8
* [new tag] 0.9.9 -> 0.9.9
* [new tag] 1.0.0 -> 1.0.0
* [new tag] 1.0.1 -> 1.0.1
* [new tag] 1.0.2 -> 1.0.2
* [new tag] 1.0.3 -> 1.0.3
* [new tag] 1.0.4 -> 1.0.4
* [new tag] 1.0.5 -> 1.0.5
* [new tag] 1.0.6 -> 1.0.6
* [new tag] 1.0.7 -> 1.0.7
* [new tag] 1.0.8 -> 1.0.8
* [new tag] 1.0.9 -> 1.0.9
* [new tag] 1.1.0 -> 1.1.0
* [new tag] 1.1.1 -> 1.1.1
HEAD is now at 89c3348 Merge pull request #1567 from cesarandreu/fix-diagnostic-conditonal
==> Homebrew has enabled anonymous aggregate user behaviour analytics
Read the analytics documentation (and how to opt-out) here:
https://git.io/brew-analytics
==> Tapping homebrew/core
Cloning into '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'...
remote: Counting objects: 3768, done.
remote: Compressing objects: 100% (3657/3657), done.
remote: Total 3768 (delta 14), reused 309 (delta 1), pack-reused 0
Receiving objects: 100% (3768/3768), 3.01 MiB | 51.00 KiB/s, done.
Resolving deltas: 100% (14/14), done.
Checking connectivity... done.
Tapped 3646 formulae (3,795 files, 9.3M)
Already up-to-date.
==> Installation successful!
==> Next steps
Run `brew help` to get started
Further documentation: https://git.io/brew-docs
Installing requirements for osx.
Updating system.......
Error running 'requirements_osx_brew_update_system ruby-2.3.0',
showing last 15 lines of /Users/mac/.rvm/log/1480093522_ruby-2.3.0/update_system.log
https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.'
++ rvm_pretty_print stderr
++ case "${rvm_pretty_print_flag:=auto}" in
++ case "${TERM:-dumb}" in
++ case "$1" in
++ [[ -t 2 ]]
++ return 1
++ printf %b 'Failed to update Homebrew, follow instructions here:
https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.\n'
Failed to update Homebrew, follow instructions here:
https://github.com/Homebrew/homebrew/wiki/Common-Issues
and make sure `brew update` works before continuing.
++ return 1
Requirements installation failed with status: 1.
6. 更新 Homebrew:
MacdeMacBook-Pro:~ mac$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
curl: (7) Failed to connect to raw.githubusercontent.com port 443: Operation timed out
MacdeMacBook-Pro:~ mac$ ruby -e "$(curl -fsSL https://raw.github.com/Homebrew/homebrew/go/install)"
curl: (22) The requested URL returned error: 404 Not Found
MacdeMacBook-Pro:~ mac$ brew install autoconf automake libtool
Updating Homebrew...
==> Downloading https://homebrew.bintray.com/bottles/autoconf-2.69.sierra.bottle
######################################################################## 100.0%
==> Pouring autoconf-2.69.sierra.bottle.4.tar.gz
==> Caveats
Emacs Lisp files have been installed to:
/usr/local/share/emacs/site-lisp/autoconf
==> Summary
🍺 /usr/local/Cellar/autoconf/2.69: 70 files, 3.0M
==> Downloading https://homebrew.bintray.com/bottles/automake-1.15.sierra.bottle
######################################################################## 100.0%
==> Pouring automake-1.15.sierra.bottle.2.tar.gz
🍺 /usr/local/Cellar/automake/1.15: 130 files, 2.9M
==> Downloading https://homebrew.bintray.com/bottles/libtool-2.4.6_1.sierra.bott
curl: (7) Failed to connect to homebrew.bintray.com port 443: Operation timed out
Error: Failed to download resource "libtool"
Download failed: https://homebrew.bintray.com/bottles/libtool-2.4.6_1.sierra.bottle.tar.gz
Warning: Bottle installation failed: building from source.
==> Using the sandbox
==> Downloading https://ftpmirror.gnu.org/libtool/libtool-2.4.6.tar.xz
==> Downloading from http://ftp.kaist.ac.kr/gnu/gnu/libtool/libtool-2.4.6.tar.xz
######################################################################## 100.0%
==> ./configure --prefix=/usr/local/Cellar/libtool/2.4.6_1 --program-prefix=g --
==> make install
==> Caveats
In order to prevent conflicts with Apple's own libtool we have prepended a "g"
so, you have instead: glibtool and glibtoolize.
==> Summary
🍺 /usr/local/Cellar/libtool/2.4.6_1: 71 files, 3.7M, built in 41 seconds
7. 安装ruby2.3.0:
MacdeMacBook-Pro:~ mac$ rvm install 2.3.0
Searching for binary rubies, this might take some time.
No binary rubies available for: osx/10.12/x86_64/ruby-2.3.0.
Continuing with compilation. Please read 'rvm help mount' to get more information on binary rubies.
Checking requirements for osx.
Installing requirements for osx.
Updating system.....
Installing required packages: pkg-config, libyaml, readline, libksba, openssl..-
Certificates in '/usr/local/etc/openssl/cert.pem' are already up to date.
Requirements installation successful.
Installing Ruby from source to: /Users/mac/.rvm/rubies/ruby-2.3.0, this may take a while depending on your cpu(s)...
ruby-2.3.0 - #downloading ruby-2.3.0, this may take a while depending on your connection...
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 13.5M 100 13.5M 0 0 20422 0 0:11:34 0:11:34 --:--:-- 23365
ruby-2.3.0 - #extracting ruby-2.3.0 to /Users/mac/.rvm/src/ruby-2.3.0....
ruby-2.3.0 - #configuring......................................................|
ruby-2.3.0 - #post-configuration.
ruby-2.3.0 - #compiling........................................................|
ruby-2.3.0 - #installing.........
ruby-2.3.0 - #making binaries executable..
Installed rubygems 2.5.1 is newer than 2.4.8 provided with installed ruby, skipping installation, use --force to force installation.
ruby-2.3.0 - #gemset created /Users/mac/.rvm/gems/ruby-2.3.0@global
ruby-2.3.0 - #importing gemset /Users/mac/.rvm/gemsets/global.gems.............|
ruby-2.3.0 - #generating global wrappers........
ruby-2.3.0 - #gemset created /Users/mac/.rvm/gems/ruby-2.3.0
ruby-2.3.0 - #importing gemsetfile /Users/mac/.rvm/gemsets/default.gems evaluated to empty gem list
ruby-2.3.0 - #generating default wrappers........
ruby-2.3.0 - #adjusting #shebangs for (gem irb erb ri rdoc testrb rake).
Install of ruby-2.3.0 - #complete
Ruby was built without documentation, to build it run: rvm docs generate-ri
MacdeMacBook-Pro:~ mac$
8. 检查ruby版本,此时不出意外ruby版本应该为2.3.0 了:
MacdeMacBook-Pro:~ mac$ ruby -v
ruby 2.3.0p0 (2015-12-25 revision 53290) [x86_64-darwin16]
MacdeMacBook-Pro:~ mac$
MacdeMacBook-Pro:~ mac$ rvm list
rvm rubies
=* ruby-2.3.0 [ x86_64 ]
# => - current //当前版本
# =* - current && default //当前且默认版本
# * - default //默认版本
MacdeMacBook-Pro:~ mac$
9. 查看ruby源:
MacdeMacBook-Pro:~ mac$ gem sources -l
*** CURRENT SOURCES ***
https://rubygems.org/
MacdeMacBook-Pro:~ mac$
10. 移除默认ruby源:
MacdeMacBook-Pro:~ mac$ gem sources -r https://rubygems.org/
https://rubygems.org/ removed from sources
MacdeMacBook-Pro:~ mac$ gem sources -l
*** CURRENT SOURCES ***
MacdeMacBook-Pro:~ mac$
11. 添加ruby-china 源:
MacdeMacBook-Pro:~ mac$ gem sources -a https://gems.ruby-china.org/
https://gems.ruby-china.org/ added to sources
MacdeMacBook-Pro:~ mac$ gem sources -l
*** CURRENT SOURCES ***
https://gems.ruby-china.org/
MacdeMacBook-Pro:~ mac$
12. 安装cocoapods:
MacdeMacBook-Pro:~ mac$ gem install cocoapods
Fetching: nanaimo-0.2.2.gem (100%)
Successfully installed nanaimo-0.2.2
Fetching: colored-1.2.gem (100%)
Successfully installed colored-1.2
Fetching: claide-1.0.1.gem (100%)
Successfully installed claide-1.0.1
Fetching: CFPropertyList-2.3.4.gem (100%)
Successfully installed CFPropertyList-2.3.4
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-4.2.7.1.gem (100%)
Successfully installed activesupport-4.2.7.1
Fetching: xcodeproj-1.4.1.gem (100%)
Successfully installed xcodeproj-1.4.1
Fetching: nap-1.1.0.gem (100%)
Successfully installed nap-1.1.0
Fetching: molinillo-0.5.4.gem (100%)
Successfully installed molinillo-0.5.4
Fetching: gh_inspector-1.0.2.gem (100%)
Successfully installed gh_inspector-1.0.2
Fetching: fourflusher-2.0.1.gem (100%)
Successfully installed fourflusher-2.0.1
Fetching: escape-0.0.4.gem (100%)
Successfully installed escape-0.0.4
Fetching: cocoapods-try-1.1.0.gem (100%)
Successfully installed cocoapods-try-1.1.0
Fetching: netrc-0.7.8.gem (100%)
Successfully installed netrc-0.7.8
Fetching: cocoapods-trunk-1.1.1.gem (100%)
Successfully installed cocoapods-trunk-1.1.1
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.1.2.gem (100%)
Successfully installed cocoapods-downloader-1.1.2
Fetching: cocoapods-deintegrate-1.0.1.gem (100%)
Successfully installed cocoapods-deintegrate-1.0.1
Fetching: fuzzy_match-2.0.4.gem (100%)
Successfully installed fuzzy_match-2.0.4
Fetching: cocoapods-core-1.1.1.gem (100%)
Successfully installed cocoapods-core-1.1.1
Fetching: cocoapods-1.1.1.gem (100%)
Successfully installed cocoapods-1.1.1
Parsing documentation for nanaimo-0.2.2
Installing ri documentation for nanaimo-0.2.2
Parsing documentation for colored-1.2
Installing ri documentation for colored-1.2
Parsing documentation for claide-1.0.1
Installing ri documentation for claide-1.0.1
Parsing documentation for CFPropertyList-2.3.4
Installing ri documentation for CFPropertyList-2.3.4
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-4.2.7.1
Installing ri documentation for activesupport-4.2.7.1
Parsing documentation for xcodeproj-1.4.1
Installing ri documentation for xcodeproj-1.4.1
Parsing documentation for nap-1.1.0
Installing ri documentation for nap-1.1.0
Parsing documentation for molinillo-0.5.4
Installing ri documentation for molinillo-0.5.4
Parsing documentation for gh_inspector-1.0.2
Installing ri documentation for gh_inspector-1.0.2
Parsing documentation for fourflusher-2.0.1
Installing ri documentation for fourflusher-2.0.1
Parsing documentation for escape-0.0.4
Installing ri documentation for escape-0.0.4
Parsing documentation for cocoapods-try-1.1.0
Installing ri documentation for cocoapods-try-1.1.0
Parsing documentation for netrc-0.7.8
Installing ri documentation for netrc-0.7.8
Parsing documentation for cocoapods-trunk-1.1.1
Installing ri documentation for cocoapods-trunk-1.1.1
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.1.2
Installing ri documentation for cocoapods-downloader-1.1.2
Parsing documentation for cocoapods-deintegrate-1.0.1
Installing ri documentation for cocoapods-deintegrate-1.0.1
Parsing documentation for fuzzy_match-2.0.4
Installing ri documentation for fuzzy_match-2.0.4
Parsing documentation for cocoapods-core-1.1.1
Installing ri documentation for cocoapods-core-1.1.1
Parsing documentation for cocoapods-1.1.1
Installing ri documentation for cocoapods-1.1.1
Done installing documentation for nanaimo, colored, claide, CFPropertyList, thread_safe, tzinfo, i18n, activesupport, xcodeproj, nap, molinillo, gh_inspector, fourflusher, escape, cocoapods-try, netrc, cocoapods-trunk, cocoapods-stats, cocoapods-search, cocoapods-plugins, cocoapods-downloader, cocoapods-deintegrate, fuzzy_match, cocoapods-core, cocoapods after 14 seconds
25 gems installed
MacdeMacBook-Pro:~ mac$
13. 查看cocoapods 版本:
MacdeMacBook-Pro:~ mac$ pod --version
1.1.1
MacdeMacBook-Pro:~ mac$
14. 安装zsh,方便后面使用 du -sh * 命令查看文件下载进度:
MacdeMacBook-Pro:repos mac$ sh -c "$(curl -fsSL https://raw.github.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Cloning Oh My Zsh...
Cloning into '/Users/mac/.oh-my-zsh'...
remote: Counting objects: 823, done.
remote: Compressing objects: 100% (693/693), done.
remote: Total 823 (delta 20), reused 683 (delta 9), pack-reused 0
Receiving objects: 100% (823/823), 559.90 KiB | 300.00 KiB/s, done.
Resolving deltas: 100% (20/20), done.
Checking connectivity... done.
Looking for an existing zsh config...
Found ~/.zshrc. Backing up to ~/.zshrc.pre-oh-my-zsh
Using the Oh My Zsh template file and adding it to ~/.zshrc
Time to change your default shell to zsh!
Changing shell for mac.
Password for mac:
__ __
____ / /_ ____ ___ __ __ ____ _____/ /_
/ __ \/ __ \ / __ `__ \/ / / / /_ / / ___/ __ \
/ /_/ / / / / / / / / / / /_/ / / /_(__ ) / / /
\____/_/ /_/ /_/ /_/ /_/\__, / /___/____/_/ /_/
/____/ ....is now installed!
Please look over the ~/.zshrc file to select plugins, themes, and options.
p.s. Follow us at https://twitter.com/ohmyzsh.
p.p.s. Get stickers and t-shirts at http://shop.planetargon.com.
MacdeMacBook-Pro:~ mac$
15. 下载cocoapods文件,期间可能报错,如下:
MacdeMacBook-Pro:~ mac$ pod --version
1.1.1
MacdeMacBook-Pro:~ mac$ pod search AFNetworking
Setting up CocoaPods master repo
Setup completed
Creating search index for spec repo 'master'.. Done!
[!] Unable to find a pod with name, author, summary, or description matching `AFNetworking`
[!] Skipping `0` because the podspec contains errors.
[!] Skipping `1` because the podspec contains errors.
[!] Skipping `2` because the podspec contains errors.
[!] Skipping `3` because the podspec contains errors.
[!] Skipping `4` because the podspec contains errors.
[!] Skipping `5` because the podspec contains errors.
[!] Skipping `6` because the podspec contains errors.
[!] Skipping `7` because the podspec contains errors.
[!] Skipping `8` because the podspec contains errors.
[!] Skipping `9` because the podspec contains errors.
[!] Skipping `a` because the podspec contains errors.
[!] Skipping `b` because the podspec contains errors.
[!] Skipping `c` because the podspec contains errors.
[!] Skipping `d` because the podspec contains errors.
[!] Skipping `e` because the podspec contains errors.
[!] Skipping `f` because the podspec contains errors.
MacdeMacBook-Pro:~ mac$
16. 解决Unable to find a pod with name, author, summary, or description matching AFNetworking
错误:
rm ~/Library/Caches/CocoaPods/search_index.json
17. 进到repos文件夹下,使用 du -sh *命令,查看repos文件大小(此文件下载完毕应该为358兆左右,下载完毕后应该会自动解压一些文件,最终大小为889兆左右,由于都是零碎小文件,因此这一步请耐心等待):
cd /Users/mac/.cocoapods/repos
**➜ ****repos** du -sh *
3M master
**➜ ****repos**
58M master
**➜ ****repos** du -sh *
215M master
**➜ ****repos** du -sh *
358M master
**➜ ****repos** du -sh *
358M master
**➜ ****repos** du -sh *
597M master
**➜ ****repos** du -sh *
893M master
**➜ ****repos** du -sh *
18. 再次运行,结果如下则证明cocoapods安装完毕且能使用了:
MacdeMacBook-Pro:~ mac$ rm ~/Library/Caches/CocoaPods/search_index.json
MacdeMacBook-Pro:~ mac$ pod search AFNetworking
Creating search index for spec repo 'master'.. Done!
-> AFNetworking (3.1.0)
A delightful iOS and OS X networking framework.
pod 'AFNetworking', '~> 3.1.0'
- Homepage: https://github.com/AFNetworking/AFNetworking
- Source: https://github.com/AFNetworking/AFNetworking.git
- Versions: 3.1.0, 3.0.4, 3.0.3, 3.0.2, 3.0.1, 3.0.0, 3.0.0-beta.3,
3.0.0-beta.2, 3.0.0-beta.1, 2.6.3, 2.6.2, 2.6.1, 2.6.0, 2.5.4, 2.5.3, 2.5.2,
2.5.1, 2.5.0, 2.4.1, 2.4.0, 2.3.1, 2.3.0, 2.2.4, 2.2.3, 2.2.2, 2.2.1, 2.2.0,
2.1.0, 2.0.3, 2.0.2, 2.0.1, 2.0.0, 2.0.0-RC3, 2.0.0-RC2, 2.0.0-RC1, 1.3.4,
1.3.3, 1.3.2, 1.3.1, 1.3.0, 1.2.1, 1.2.0, 1.1.0, 1.0.1, 1.0, 1.0RC3, 1.0RC2,
1.0RC1, 0.10.1, 0.10.0, 0.9.2, 0.9.1, 0.9.0, 0.7.0, 0.5.1 [master repo]
- Subspecs:
- AFNetworking/Serialization (3.1.0)
- AFNetworking/Security (3.1.0)
- AFNetworking/Reachability (3.1.0)
- AFNetworking/NSURLSession (3.1.0)
- AFNetworking/UIKit (3.1.0)
.....
二、rbenv 安装ruby
1. 安装brew,使用brew可以帮我们安装下载一些软件:
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
2. 使用brew安装rbenv:
brew install rbenv
3. 安装ruby-build:
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build
4. 安装 ruby-china 镜像:
git clone https://github.com/andorchen/rbenv-china-mirror.git ~/.rbenv/plugins/rbenv-china-mirror
5. 使用 rbenv 安装 ruby ,这里我们选择2.3.0:
rbenv install 2.3.0
6. 设置全局的 ruby 版本,默认是2.0.0:
rbenv global 2.3.0
7. 去掉原生的 gem 源,替换为 ruby-china 源:
gem sources --a https://gems.ruby-china.org/
gem sources --r https://rubygems.org/
8. 更新 gem 版本:
gem update --system
9. 安装所需要的 CocoaPods:
gem install cocoapods -v 1.1.1
以下是通过rbenv 安装的过程,一些重要安装步骤的截图记录,以供参考:
rbenv-01.jpg rbenv-02.png rbenv-03.png以上就是通过rbenv 安装ruby ,安装成功后,切换默认ruby版本,最后安装cocoapods即可。