借鉴文章链接:https://www.cnblogs.com/Llh-Forerer2015/p/6000249.html
Last login: Fri Mar 23 06:15:38 on console
simpleyudeMacBook-Air:~ simpleyu$ pod setup
Setting up CocoaPods master repo
$ /usr/bin/git clone https://github.com/CocoaPods/Specs.git master --progress
Cloning into 'master'...
remote: Counting objects: 2010943, done.
remote: Compressing objects: 100% (321/321), done.
remote: Total 2010943 (delta 144), reused 36 (delta 36), pack-reused 2010571
Receiving objects: 100% (2010943/2010943), 523.74 MiB | 776.00 KiB/s, done.
Resolving deltas: 100% (1126390/1126390), done.
Checking out files: 100% (224416/224416), done.
Setup completed
simpleyudeMacBook-Air:~ simpleyu$ sudo gem install cocoapods
Password:
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
simpleyudeMacBook-Air:~ simpleyu$ pod search AFNetworking
/Library/Ruby/Site/2.3.0/rubygems.rb:271:in find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException) from /Library/Ruby/Site/2.3.0/rubygems.rb:299:in
activate_bin_path'
from /usr/local/bin/pod:23:in <main>' simpleyudeMacBook-Air:~ simpleyu$ pod update /Library/Ruby/Site/2.3.0/rubygems.rb:271:in
find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException)
from /Library/Ruby/Site/2.3.0/rubygems.rb:299:in activate_bin_path' from /usr/local/bin/pod:23:in
<main>'
simpleyudeMacBook-Air:~ simpleyu$ sudo gem update --system
Latest version currently installed. Aborting.
simpleyudeMacBook-Air:~ simpleyu$ pod repo list
/Library/Ruby/Site/2.3.0/rubygems.rb:271:in find_spec_for_exe': can't find gem cocoapods (>= 0.a) (Gem::GemNotFoundException) from /Library/Ruby/Site/2.3.0/rubygems.rb:299:in
activate_bin_path'
from /usr/local/bin/pod:23:in `<main>'
simpleyudeMacBook-Air:~ simpleyu$ ruby -e
ruby: no code specified for -e (RuntimeError)
simpleyudeMacBook-Air:~ simpleyu$ brew update
-bash: brew: command not found
simpleyudeMacBook-Air:~ simpleyu$ ruby --version
ruby 2.3.3p222 (2016-11-21 revision 56859) [universal.x86_64-darwin17]
simpleyudeMacBook-Air:~ simpleyu$ rvm lis
-bash: rvm: command not found
simpleyudeMacBook-Air:~ simpleyu$ rvm list
-bash: rvm: command not found
simpleyudeMacBook-Air:~ simpleyu$ rvm list rvm rubies
-bash: rvm: command not found
simpleyudeMacBook-Air:~ simpleyu$ rvm rubies
-bash: rvm: command not found
simpleyudeMacBook-Air:~ simpleyu$ rbenv versions
-bash: rbenv: command not found
simpleyudeMacBook-Air:~ simpleyu$ which pod
/usr/local/bin/pod
simpleyudeMacBook-Air:~ simpleyu$ sudo rm -rf /usr/local/bin/pod
Password:
simpleyudeMacBook-Air:~ simpleyu$ gem list
*** LOCAL GEMS ***
activesupport (4.2.10)
atomos (0.1.2)
bigdecimal (default: 1.2.8)
CFPropertyList (2.3.6, 2.2.8)
claide (1.0.2)
cocoapods-core (1.4.0)
cocoapods-deintegrate (1.0.2)
cocoapods-downloader (1.1.3)
cocoapods-plugins (1.0.0)
cocoapods-search (1.0.0)
cocoapods-stats (1.0.0)
cocoapods-trunk (1.3.0)
cocoapods-try (1.1.0)
colored2 (3.1.2)
concurrent-ruby (1.0.5)
did_you_mean (1.0.0)
escape (0.0.4)
fourflusher (2.0.1)
fuzzy_match (2.0.4)
gh_inspector (1.1.3)
i18n (0.9.5)
io-console (default: 0.4.5)
json (default: 1.8.3)
libxml-ruby (2.9.0)
minitest (5.8.5)
molinillo (0.6.4)
nanaimo (0.2.3)
nap (1.1.0)
net-telnet (0.1.1)
netrc (0.11.0)
nokogiri (1.5.6)
power_assert (0.2.6)
psych (default: 2.1.0)
rake (10.4.2)
rdoc (default: 4.2.1)
ruby-macho (1.1.0)
rubygems-update (2.6.14)
sqlite3 (1.3.11)
test-unit (3.1.5)
thread_safe (0.3.6)
tzinfo (1.2.5)
xcodeproj (1.5.6)
simpleyudeMacBook-Air:~ simpleyu$ sudo gem uninstall cocoapods -v 1.1.1
simpleyudeMacBook-Air:~ simpleyu$ sudo gem uninstall cocoapods-core -v 1.1.1
ERROR: While executing gem ... (Gem::InstallError)
gem "cocoapods-core" is not installed
simpleyudeMacBook-Air:~ simpleyu$ sudo gem uninstall cocoapods -v 1.1.1
simpleyudeMacBook-Air:~ simpleyu$ sudo gem install cocoapods
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
simpleyudeMacBook-Air:~ simpleyu$ sudo gem install -n /usr/local/bin cocoapods
Successfully installed cocoapods-1.4.0
Parsing documentation for cocoapods-1.4.0
Done installing documentation for cocoapods after 3 seconds
1 gem installed
simpleyudeMacBook-Air:~ simpleyu$ gem sources -l
*** CURRENT SOURCES ***
https://ruby.taobao.org/
simpleyudeMacBook-Air:~ simpleyu$ pod setup
Setting up CocoaPods master repo
$ /usr/bin/git -C
/Users/simpleyu/.cocoapods/repos/master fetch origin
--progress
remote: Counting objects: 9, done.
remote: Compressing objects: 100% (8/8), done.
remote: Total 9 (delta 5), reused 0 (delta 0), pack-reused 0
From https://github.com/CocoaPods/Specs
fd21e595d73..4e04fcd491a master -> origin/master
$ /usr/bin/git -C
/Users/simpleyu/.cocoapods/repos/master rev-parse
--abbrev-ref HEAD
master
$ /usr/bin/git -C
/Users/simpleyu/.cocoapods/repos/master reset --hard
origin/master
HEAD is now at 4e04fcd491a [Add] TCMPTappy 0.1.0
Setup completed
simpleyudeMacBook-Air:~ simpleyu$ pod search AFNetworking
Creating search index for spec repo 'master'.. Done!
https://github.com/zhengkai85/ZKAFJSONRPCClient
- Source:
https://github.com/zhengkai85/ZKAFJSONRPCClient.git - Versions: 1.0.3, 1.0.2, 1.0.1, 1.0.0 [master repo]
-> AFNetworking (3.2.0)
A delightful iOS and OS X networking framework.
pod 'AFNetworking', '~> 3.2.0'
- Homepage:
https://github.com/AFNetworking/AFNetworking - Source:
https://github.com/AFNetworking/AFNetworking.git - Versions: 3.2.0, 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.2.0)
- AFNetworking/Security (3.2.0)
- AFNetworking/Reachability (3.2.0)
- AFNetworking/NSURLSession (3.2.0)
:
*****************中间省略一堆关于AFnetworking的框架************
-> ZLLAFNPackUtils (1.0.2)
A Net Request util base on
AFNetworking(基于AFNetworking的二次封装工具库)
pod 'ZLLAFNPackUtils', '~> 1.0.2'
- Homepage:
https://github.com/LingliZ/ZLLAFNPackUtils - Source:
https://github.com/LingliZ/ZLLAFNPackUtils.git - Versions: 1.0.2, 1.0.0 [master repo]
-> ZLYNetWorking (0.0.1)
A network Framework based on AFNetworking
pod 'ZLYNetWorking', '~> 0.0.1'
- Homepage:
https://github.com/lianyu125/ZLYNetWorking - Source:
https://github.com/lianyu125/ZLYNetWorking.git - Versions: 0.0.1 [master repo]
(END)
**********************遇到的第二个问题*******************
CocoaPods 1.5.0.beta.1 is available.
To update use: sudo gem install cocoapods --pre
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.5.0.beta.1
执行:sudo gem install cocoapods --pre后
显示的结果是:ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
然后执行了2个解决方法:
1.sudo gem install -n /usr/local/bin cocoapods --pre
2.sudo gem install -n /usr/local/bin cocoapods
以下是流程:
CocoaPods 1.5.0.beta.1 is available.
To update use: sudo gem install cocoapods --pre
[!] This is a test version we'd love you to try.
For more information, see https://blog.cocoapods.org and the CHANGELOG for this version at https://github.com/CocoaPods/CocoaPods/releases/tag/1.5.0.beta.1
Setup completed
simpleyudeMacBook-Air:ITSNSDemo simpleyu$ sudo gem install cocoapods --pre
Fetching: cocoapods-core-1.5.0.beta.1.gem (100%)
Successfully installed cocoapods-core-1.5.0.beta.1
Fetching: molinillo-0.6.5.gem (100%)
Successfully installed molinillo-0.6.5
Fetching: nanaimo-0.2.4.gem (100%)
Successfully installed nanaimo-0.2.4
Fetching: xcodeproj-1.5.7.gem (100%)
ERROR: While executing gem ... (Gem::FilePermissionError)
You don't have write permissions for the /usr/bin directory.
simpleyudeMacBook-Air:ITSNSDemo simpleyu$ sudo gem install -n /usr/local/bin cocoapods --pre
Successfully installed xcodeproj-1.5.7
Fetching: cocoapods-1.5.0.beta.1.gem (100%)
Successfully installed cocoapods-1.5.0.beta.1
Parsing documentation for xcodeproj-1.5.7
Installing ri documentation for xcodeproj-1.5.7
Parsing documentation for cocoapods-1.5.0.beta.1
Installing ri documentation for cocoapods-1.5.0.beta.1
Done installing documentation for xcodeproj, cocoapods after 7 seconds
2 gems installed
simpleyudeMacBook-Air:ITSNSDemo simpleyu$ brew upgrade brew install cocoapods
-bash: brew: command not found
simpleyudeMacBook-Air:ITSNSDemo simpleyu$ sudo gem install -n /usr/local/bin cocoapods
Successfully installed cocoapods-1.4.0
Parsing documentation for cocoapods-1.4.0
Done installing documentation for cocoapods after 3 seconds
1 gem installed