转自:点击打开链接
(1)在终端输入以下命令:
pod repo list
结果为0 repos时说明安装不成功,自己可以查看下自己的安装步骤,看看是哪一步出现了问题。
(2)出现以下错误:
ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/xcodeproj
在网上寻找的解决方法:
在终端中输入:sudo nvram boot-args="rootless=0"; sudo reboot
然后你的电脑会重启
之后再输入sudo gem install cocoapods -V
就可以了。
(3)pod setup时出现以下错误:
[!] /usr/bin/git clone https://github.com/CocoaPods/Specs.git master
Cloning into 'master'...
error: RPC failed; curl 56 SSLRead() return error -36
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
You can try adding it manually in `~/.cocoapods/repos` or via `pod repo add`.
自己按照提示在终端输入以下命令:
pod repo add master https://github.com/CocoaPods/Specs.git
还是报错!
在网上查到的解决办法:在终端输入以下命令:
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developers
后面的地址你可以打开Xcode显示包内容,找到那个文件夹拖到终端里面。
(4)当出现如下:
[!] An error occurred while performing `Git pull` on repo `master`.
[!] /usr/bin/git pull --ff-only
这个错误应该是说这个节点有问题。把cocoapods的节点删除,重新添加一个节点。
删除master分支 重新建立新的分支
sudo rm -fr ~/.cocoapods/repos/master
然后再: pod setup
(5)出现The dependency `AFNetworking ` is not used in any concrete target:
podfile升级之后到最新版本,pod里的内容必须明确指出所用第三方库的target,否则会出现The dependency `` is not used in any concrete target这样的错误。
(6)试过以上所有解决办法,还是没有安装成功:
重新安装(其实我就是这样安装成功的):
首先,删除.cocoapods目录,在终端输入以下命令:
sudo rm -rf ~/.cocoapods/
然后,重新下载安装,在终端输入以下命令:
pod setup