cocoaPods遇到的坑

借鉴文章链接: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:inactivate_bin_path'
from /usr/local/bin/pod:23:in <main>' simpleyudeMacBook-Air:~ simpleyu$ pod update /Library/Ruby/Site/2.3.0/rubygems.rb:271:infind_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:inactivate_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

-> 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'

-> ZLYNetWorking (0.0.1)
A network Framework based on AFNetworking
pod 'ZLYNetWorking', '~> 0.0.1'

**********************遇到的第二个问题*******************
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

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
  • 序言:七十年代末,一起剥皮案震惊了整个滨河市,随后出现的几起案子,更是在滨河造成了极大的恐慌,老刑警刘岩,带你破解...
    沈念sama阅读 212,029评论 6 492
  • 序言:滨河连续发生了三起死亡事件,死亡现场离奇诡异,居然都是意外死亡,警方通过查阅死者的电脑和手机,发现死者居然都...
    沈念sama阅读 90,395评论 3 385
  • 文/潘晓璐 我一进店门,熙熙楼的掌柜王于贵愁眉苦脸地迎上来,“玉大人,你说我怎么就摊上这事。” “怎么了?”我有些...
    开封第一讲书人阅读 157,570评论 0 348
  • 文/不坏的土叔 我叫张陵,是天一观的道长。 经常有香客问我,道长,这世上最难降的妖魔是什么? 我笑而不...
    开封第一讲书人阅读 56,535评论 1 284
  • 正文 为了忘掉前任,我火速办了婚礼,结果婚礼上,老公的妹妹穿的比我还像新娘。我一直安慰自己,他们只是感情好,可当我...
    茶点故事阅读 65,650评论 6 386
  • 文/花漫 我一把揭开白布。 她就那样静静地躺着,像睡着了一般。 火红的嫁衣衬着肌肤如雪。 梳的纹丝不乱的头发上,一...
    开封第一讲书人阅读 49,850评论 1 290
  • 那天,我揣着相机与录音,去河边找鬼。 笑死,一个胖子当着我的面吹牛,可吹牛的内容都是我干的。 我是一名探鬼主播,决...
    沈念sama阅读 39,006评论 3 408
  • 文/苍兰香墨 我猛地睁开眼,长吁一口气:“原来是场噩梦啊……” “哼!你这毒妇竟也来了?” 一声冷哼从身侧响起,我...
    开封第一讲书人阅读 37,747评论 0 268
  • 序言:老挝万荣一对情侣失踪,失踪者是张志新(化名)和其女友刘颖,没想到半个月后,有当地人在树林里发现了一具尸体,经...
    沈念sama阅读 44,207评论 1 303
  • 正文 独居荒郊野岭守林人离奇死亡,尸身上长有42处带血的脓包…… 初始之章·张勋 以下内容为张勋视角 年9月15日...
    茶点故事阅读 36,536评论 2 327
  • 正文 我和宋清朗相恋三年,在试婚纱的时候发现自己被绿了。 大学时的朋友给我发了我未婚夫和他白月光在一起吃饭的照片。...
    茶点故事阅读 38,683评论 1 341
  • 序言:一个原本活蹦乱跳的男人离奇死亡,死状恐怖,灵堂内的尸体忽然破棺而出,到底是诈尸还是另有隐情,我是刑警宁泽,带...
    沈念sama阅读 34,342评论 4 330
  • 正文 年R本政府宣布,位于F岛的核电站,受9级特大地震影响,放射性物质发生泄漏。R本人自食恶果不足惜,却给世界环境...
    茶点故事阅读 39,964评论 3 315
  • 文/蒙蒙 一、第九天 我趴在偏房一处隐蔽的房顶上张望。 院中可真热闹,春花似锦、人声如沸。这庄子的主人今日做“春日...
    开封第一讲书人阅读 30,772评论 0 21
  • 文/苍兰香墨 我抬头看了看天上的太阳。三九已至,却和暖如春,着一层夹袄步出监牢的瞬间,已是汗流浃背。 一阵脚步声响...
    开封第一讲书人阅读 32,004评论 1 266
  • 我被黑心中介骗来泰国打工, 没想到刚下飞机就差点儿被人妖公主榨干…… 1. 我叫王不留,地道东北人。 一个月前我还...
    沈念sama阅读 46,401评论 2 360
  • 正文 我出身青楼,却偏偏与公主长得像,于是被迫代替她去往敌国和亲。 传闻我的和亲对象是个残疾皇子,可洞房花烛夜当晚...
    茶点故事阅读 43,566评论 2 349

推荐阅读更多精彩内容