安装Cocoapods 0.35.0时出错

时间:2015-06-18 11:02:34

标签: ios ruby gem cocoapods

我正在尝试使用以下命令安装Cocoapods版本0.35.0:

sudo gem install cocoapods --version 0.35.0

当我尝试使用

验证版本时
pod --version

我收到以下错误:

---------------------------------------------
Error loading the plugin with path `/Library/Ruby/Gems/2.0.0/gems/cocoapods-try-0.4.5/lib/cocoapods_plugin.rb`.

NoMethodError - undefined method `tmpdir' for Dir:Class
/Library/Ruby/Gems/2.0.0/gems/cocoapods-try-0.4.5/lib/pod/command/try.rb:66:in `<class:Try>'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-try-0.4.5/lib/pod/command/try.rb:8:in `<class:Command>'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-try-0.4.5/lib/pod/command/try.rb:5:in `<module:Pod>'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-try-0.4.5/lib/pod/command/try.rb:4:in `<top (required)>'
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:121:in `require'
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:121:in `require'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-try-0.4.5/lib/cocoapods_plugin.rb:1:in `<top (required)>'
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:121:in `require'
/Library/Ruby/Site/2.0.0/rubygems/core_ext/kernel_require.rb:121:in `require'
/Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command/plugins_helper.rb:104:in `safe_require'
/Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command/plugins_helper.rb:32:in `block in load_plugins'
/Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command/plugins_helper.rb:31:in `each'
/Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command/plugins_helper.rb:31:in `load_plugins'
/Library/Ruby/Gems/2.0.0/gems/claide-0.7.0/lib/claide/command.rb:265:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/lib/cocoapods/command.rb:45:in `run'
/Library/Ruby/Gems/2.0.0/gems/cocoapods-0.35.0/bin/pod:43:in `<top (required)>'
/usr/bin/pod:23:in `load'
/usr/bin/pod:23:in `<main>'
---------------------------------------------

0.35.0

我试图卸载cocoapods和xcodeproj并重新安装但它不起作用。之前我还有其他三个类似的错误,但我用

摆脱了它们
sudo gem update --system

不过,我无法解决最后一个错误。

2 个答案:

答案 0 :(得分:5)

我使用 RVM 解决了这个问题,因为我发现错误可能与我的mac上的ruby版本控制有关。我刚用

安装了它
\curl -sSL https://get.rvm.io | bash -s stable --ruby

然后Cocoapods顺利安装。

答案 1 :(得分:0)

我遇到了与ruby 2.1.2相同的问题,但似乎。 ruby-2.2.2工作正常