首页 > 解决方案 > 如何在 macOS Mojave 版本 10.14.2 上安装 CocoaPods?

问题描述

我正在尝试在 macOS Mojave 版本 10.14.2 上安装 CocoaPods,但我收到下面报告的错误。这个问题的可能解决方案是什么?

先感谢您

亲切的问候

Last login: Sun Aug 16 16:21:38 on ttys000
d-i89-230-83:~ mymac$ sudo gem install cocoapods
Password:
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.3.0/gems/ffi-1.13.1/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/bin/ruby -r ./siteconf20200816-2278-1pv037b.rb extconf.rb
checking for ffi.h... no
checking for ffi.h in /usr/local/include,/usr/include/ffi,/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk/usr/include/ffi,/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk/usr/include/ffi... yes
checking for ffi_prep_closure_loc() in -lffi... no
checking for ffi_prep_closure_loc() in -llibffi... no
checking for ffi_prep_closure_loc() in -llibffi-8... no
creating extconf.h
creating Makefile

To see why this extension failed to compile, please check the mkmf.log which can be found here:

  /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.13.1/mkmf.log

current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.13.1/ext/ffi_c
make "DESTDIR=" clean

current directory: /Library/Ruby/Gems/2.3.0/gems/ffi-1.13.1/ext/ffi_c
make "DESTDIR="
Configuring libffi
mkdir: /tmp: No such file or directory
mkdir: /tmp: No such file or directory
config.guess: cannot create a temporary directory in /tmp
configure: error: cannot guess build type; you must specify one
make: *** ["/Library/Ruby/Gems/2.3.0/gems/ffi-1.13.1/ext/ffi_c/libffi-universal-darwin18"/.libs/libffi_convenience.a] Error 1

make failed, exit code 2

Gem files will remain installed in /Library/Ruby/Gems/2.3.0/gems/ffi-1.13.1 for inspection.
Results logged to /Library/Ruby/Gems/2.3.0/extensions/universal-darwin-18/2.3.0/ffi-1.13.1/gem_make.out
d-i89-230-83:~ mymac$ 

标签: ruby-on-railsrubycocoapods

解决方案


从输出中我看到您缺少一些构建 gem 所需的 C 库。先安装libffi再试。

您可以为此使用Brew

brew install libffi

推荐阅读