更新了cocoapods出现了这样的问题

$ sudo pod install

/Users/YSQ/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/claide-0.5.0/lib/claide/command.rb:328:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)

CocoaPods, the Objective-C library package manager.

Commands:

* help       Show help for the given command.
* init       Generate a Podfile for the current directory.
- install    Install project dependencies
* ipc        Inter-process communication
* lib        Develop pods
* list       List pods
* outdated   Show outdated project dependencies
* push       Push new specifications to a spec-repo
* repo       Manage spec-repositories
* search     Searches for pods
* setup      Setup the CocoaPods environment
* spec       Manage pod specs
* update     Update outdated project dependencies

Options:

--silent    Show nothing
--version   Show the version of CocoaPods
--no-ansi   Show output without ANSI codes
--verbose   Show more debugging information
--help      Show help banner of specified command
from /Users/YSQ/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.32.1/lib/cocoapods/command.rb:46:in `run'
from /Users/YSQ/.rvm/rubies/ruby-2.0.0-p247/lib/ruby/gems/2.0.0/gems/cocoapods-0.32.1/bin/pod:33:in `<top (required)>'
from /Users/YSQ/.rvm/rubies/ruby-2.0.0-p247/bin/pod:23:in `load'
from /Users/YSQ/.rvm/rubies/ruby-2.0.0-p247/bin/pod:23:in `<main>'
阅读 38k
10 个回答

直接 $ [sudo] gem install cocoapods 就好了,sudo 可选.

sudo pod install

You cannot run CocoaPods as root

新手上路,请多包涵

楼主,我也遇到同样的问题,昨天更新的cocoapods0.32.1后出
现/Library/Ruby/Gems/2.0.0/gems/claide-0.5.0/lib/claide/command.rb:328:in `help!': [!] You cannot run CocoaPods as root. (CLAide::Help)

CocoaPods, the Objective-C library package manager.

Commands:

* help       Show help for the given command.
* init       Generate a Podfile for the current directory.
- install    Install project dependencies
* ipc        Inter-process communication
* lib        Develop pods
* list       List pods
* outdated   Show outdated project dependencies
* push       Push new specifications to a spec-repo
* repo       Manage spec-repositories
* search     Searches for pods
* setup      Setup the CocoaPods environment
* spec       Manage pod specs
* update     Update outdated project dependencies

Options:

--silent    Show nothing
--version   Show the version of CocoaPods
--no-ansi   Show output without ANSI codes
--verbose   Show more debugging information
--help      Show help banner of specified command
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.32.1/lib/cocoapods/command.rb:46:in `run'
from /Library/Ruby/Gems/2.0.0/gems/cocoapods-0.32.1/bin/pod:33:in `<top (required)>'
from /usr/bin/pod:23:in `load'
from /usr/bin/pod:23:in `<main>'

先运行 sudo rm -fr ~/.cocoapods/repos/master
然后 pod setup
试试...

sudo rm -fr ~/.cocoapods/repos/master
pod setup
pod repo remove master
pod setup

用上面的代码,原因是cocoapods升级后出现冲突。
如果速度慢的话,且你有gae,给本次的终端设置代理

export http_proxy='http://127.0.0.1:8087'
export https_proxy='http://127.0.0.1:8087'

如果你遇到git证书问题,可以导入gae的证书

git config --global http.sslCAinfo ~/goagent/local/CA.crt 

以上

新手上路,请多包涵

以上答案皆不管用。

新手上路,请多包涵

CocoaPods 在 0.32.0 去掉了 root 权限运行命令。这个问题可能是缓存中有一些需要 root 权限运行的文件,所以试试删除缓存的方法。

先删除全局的缓存:

$ sudo rm -fr ~/Library/Caches/CocoaPods/
$ sudo rm -fr ~/.cocoapods/repos/master/

还不行的话就把当前 Pods 目录清空:

$ sudo rm -fr Pods/

之后再运行:

$ pod install

CocoaPods 的 Troubleshooting 有一段解释:I'm getting permission errors while running pod commands

新手上路,请多包涵
$ sudo gem uninstall cocoapods
$ sudo gem uninstall xcodeproj
$ sudo gem install xcodeproj
$ sudo gem install cocoapods
新手上路,请多包涵

 接着执行运行:$ sudo gem install cocoa pods

         $ pod install
         

就好了

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题