在 mac 上安装 cocoapods 失败
Posted
技术标签:
【中文标题】在 mac 上安装 cocoapods 失败【英文标题】:install cocoapods failed on mac 【发布时间】:2014-07-19 14:23:57 【问题描述】:我尝试按照http://cocoapods.org/的说明在mac上安装cocoapods,但得到如下错误:
$sudo gem install cocoapods
ERROR: While executing gem ... (Gem::RemoteFetcher::FetchError)
bad response Service Unavailable: Back-end server is at capacity 503 (https://api.rubygems.org/api/v1/dependencies?gems=cocoapods)
但有时,错误信息会有所不同。
$ sudo gem install cocoapods
Password:
Building native extensions. This could take a while...
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.
rake RUBYARCHDIR=/Users/tap4fun/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-12/1.9.1/xcodeproj-0.17.0 RUBYLIBDIR=/Users/tap4fun/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-12/1.9.1/xcodeproj-0.17.0/Users/tap4fun/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:298:in `to_specs': Could not find 'rake' (>= 0) among 20 total gem(s) (Gem::LoadError)
from /Users/tap4fun/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/dependency.rb:309:in `to_spec'
from /Users/tap4fun/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/site_ruby/1.9.1/rubygems/core_ext/kernel_gem.rb:53:in `gem'
from /Users/tap4fun/.rvm/gems/ruby-1.9.3-p484/bin/rake:22:in `<main>'
from /Users/tap4fun/.rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `eval'
from /Users/tap4fun/.rvm/gems/ruby-1.9.3-p484/bin/ruby_executable_hooks:15:in `<main>'
rake failed, exit code 1
Gem files will remain installed in /Users/tap4fun/.rvm/rubies/ruby-1.9.3- p484/lib/ruby/gems/1.9.1/gems/xcodeproj-0.17.0 for inspection.
Results logged to /Users/tap4fun/.rvm/rubies/ruby-1.9.3-p484/lib/ruby/gems/1.9.1/extensions/x86_64-darwin-12/1.9.1/xcodeproj-0.17.0/gem_make.out
红宝石版本:1.9.3
rake 版本:10.2.2
【问题讨论】:
你在 OSX Yosemite 上吗? 是的,版本是10.9.3 上述方法也适用于最新的 MacOS Beta 和 Xcode Beta,以防万一有人感兴趣... 【参考方案1】:试试这个(使用 OSX 10.10 为我工作)
-
打开 Xcode 6
打开首选项
点击位置标签
将命令行工具版本更改为 Xcode 6.0
卸载 cocoapods
$ sudo gem 卸载 cocoapods
安装 xcodeproj
$ sudo gem install xcodeproj
安装 cocoapods
$ sudo gem install cocoapods
运行pod --version
进行验证
【讨论】:
它不起作用,错误:安装 xcodeproj 时出错:错误:无法构建 gem 原生扩展。/Users/tap4fun/.rvm/rubies/ruby-1.9.3-p484/lib/ruby /site_ruby/1.9.1/rubygems/dependency.rb:298:in `to_specs':在总共 20 个 gem 中找不到 'rake' (>= 0) (Gem::LoadError) 好吧,你遇到了和我一样的问题...所以首先在终端输入: ruby -e "$(curl -fsSL raw.github.com/Homebrew/homebrew/go/install)" 那我该怎么办? $ brew install postgresql 我在安装 postgresql 时遇到错误,错误:Homebrew 不知道您的 Xcode (6.0) 版本附带了哪些编译器版本。请brew update
,如果这没有帮助,请在brew --config
的输出中提出问题:github.com/Homebrew/homebrew/issues 请注意,我们只跟踪稳定、已发布的 Xcode 版本。以上是关于在 mac 上安装 cocoapods 失败的主要内容,如果未能解决你的问题,请参考以下文章
在 Mac OS Catalina (10.15.7) 上安装 cocoapods 时出错
最新Mac OS X 10.12.1 安装cocoapods及使用详解