CocoaPod遇到更新不了的原因

CocoaPods 1.0.1 is available.

To update use: `gem install cocoapods`

Until we reach version 1.0 the features of CocoaPods can and will change.

We strongly recommend that you use the latest version at all times.

建议下载最新的CocoaPods 但是为什么会装

但是输入gem install cocoapods

下面缺提示

ERROR:  While executing gem ... (Errno::EACCES)

    Permission denied - /Library/Ruby/Gems/2.0.0/gems/xcodeproj-1.1.0/LICENSE

在执行gem的时候,确提示没有权限

输入

sudo gem install -n /usr/local/bin cocoapods --pre

就可以都下载好了

Mac-mini:模拟E路通下载数据 yuyunjun$ sudo gem install -n /usr/local/bin cocoapods --pre

Successfully installed xcodeproj-1.1.0

Fetching: fourflusher-0.3.1.gem (100%)

Successfully installed fourflusher-0.3.1

Fetching: cocoapods-1.0.1.gem (100%)

Successfully installed cocoapods-1.0.1

Parsing documentation for xcodeproj-1.1.0

Installing ri documentation for xcodeproj-1.1.0

Parsing documentation for fourflusher-0.3.1

Installing ri documentation for fourflusher-0.3.1

Parsing documentation for cocoapods-1.0.1

Installing ri documentation for cocoapods-1.0.1

3 gems installed

如果在执行sudo gem install cocoapods的时候报以下错误:

ERROR: While executing gem ... (Errno::EPERM)
Operation not permitted - /usr/bin/pod

并且你的操作系统是EI Caption,可是尝试使用以下方法来代替上面的安装命令:

sudo gem install -n /usr/local/bin cocoapods

附:如何使用CocoaPods的镜像索引:
所有项目的Podspec文件都托管在https://github.com/CocoaPods/Specs,
第一次执行pod setup时,CocoaPods会将这些podspec索引文件更新到本地的~/.cocoapods目录下,
这个索引文件比较大,所以第一次更新时非常慢.
友好人士在国内的服务器建立了Cocoapods索引库的镜像,
所以执行索引跟新操作时候会快很多.具体操作方法如下:
$ pod repo remove master
$ pod repo add master https://gitcafe.com/akuandev/Specs.git
$ pod repo update
这是使用gitcafe上的镜像,将以上代码中的 https://gitcafe.com/akuandev/Specs.git 
替换成 http://git.oschina.net/akuandev/Specs.git 即可使用oschina上的镜像。




原文地址:https://www.cnblogs.com/yyj900165/p/5586444.html