【问题标题】:Unable to install Cocoapods on macOS 10.15.4无法在 macOS 10.15.4 上安装 Cocoapods
【发布时间】:2020-09-10 16:47:41
【问题描述】:

当我执行sudo gem install cocoapods 时,它会返回以下内容:

Building native extensions. This could take a while...
ERROR:  Error installing cocoapods:
    ERROR: Failed to build gem native extension.

    current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.12.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0 -r ./siteconf20200524-27428-t6f6h6.rb extconf.rb
mkmf.rb can't find header files for ruby at /System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/include/ruby.h

You might have to install separate package for the ruby development
environment, ruby-dev or ruby-devel for example.

extconf failed, exit code 1

Gem files will remain installed in /Library/Ruby/Gems/2.6.0/gems/ffi-1.12.2 for inspection.
Results logged to /Library/Ruby/Gems/2.6.0/extensions/universal-darwin-19/2.6.0/ffi-1.12.2/gem_make.out

知道问题出在哪里吗?

【问题讨论】:

  • 永远不要这样做!作为 macOS 的一部分发布的 Ruby仅供 Apple 内部使用。如果您想使用 Ruby,您必须自己安装适当的 Ruby 实现

标签: ios swift ruby macos


【解决方案1】:

如果没有 Homebrew,请先安装:https://brew.sh/index_pt-br

/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install.sh)"

其次,如果没有 ruby​​,请安装它: https://www.ruby-lang.org/pt/documentation/installation/

brew install ruby

您也可以按照以下步骤操作:https://gist.github.com/monicao/d372716cdfbb7e9cf692

然后,关闭您的终端并重新打开它。

始终使用 sudo 安装 cocoapods:

sudo gem install cocoapods

另外,您需要安装 Xcode 的开发者工具。最简单的方法是通过终端 (this question)

xcode-select --install

【讨论】:

  • 安装 Homebrew 让我可以继续安装 - 谢谢!
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 2017-06-16
  • 1970-01-01
  • 2021-03-15
  • 1970-01-01
  • 2020-07-28
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多