简体   繁体   中英

How to install CocoaPods on macOS Mojave version 10.14.2?

I am trying to install CocoaPods on macOS Mojave version 10.14.2 but I get the error reported below. What would be a possible solution to this problem?

Thank you in advance

Kind regards

I

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$ 

From the output I see that you are missing some C libraries needed to build the gem. Install libffi first and try again.

You can use Brew for that:

brew install libffi

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM