Error installing Cocoapods

Hi everyone, Im having issues finding solutions to this online. Im trying to get cocoaspods installed into my unity project for IOS. I’ve been trying all sorts of solutions that are on the unity forums, stackoverflow, etc, and I also tried doing the sudo gem install cocoapods in the Terminal, but it keeps failing and I can’t figure out why. I have the latest version of Xcode installed too. Can anyone help me with a solution to this error of failing to install cocoaspods? I appreciate any help.

Here’s the error I get, and this is after I installed the Google Admob package from Github and imported it into my IOS project for Unity.

WARNING: You don’t have /Users/dyach/.gem/ruby/2.6.0/bin in your PATH,
gem executables will not run.
ERROR: Error installing cocoapods:
ERROR: Failed to build gem native extension.

In the inspector I get more of the error coming up. It says:

Failed to install CocoaPods for the current user.

It will not be possible to install Cocoapods in the generated Xcode project which will result in link errors when building your application.

For more information see:

‘gem install cocoapods --user-install’ failed with code (1):
Building native extensions. This could take a while…
Users/dyach/.gem/ruby/2.6.0/gems/ffi-1.14.2/ext/ffi_c
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/ruby -I /Library/Ruby/Site/2.6.0 -r ./siteconf2020126-5604-knuzif.rb extconf.rb
checking for ffi.h… *** extconf.rb failed ***

Could not create Makefile due to some reason, probably lack of necessary
libraries and/or headers. Check the mkmf.log file for more details. You may
need configuration options.

Provided configuration options:
–with-opt-dir
–without-opt-dir
–with-opt-include
–without-opt-include={opt-dir}/include --with-opt-lib --without-opt-lib={opt-dir}/lib
–with-make-prog
–without-make-prog
–srcdir=.
–curdir
–ruby=/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/bin/(RUBY_BASE_NAME) --with-ffi_c-dir --without-ffi_c-dir --with-ffi_c-include --without-ffi_c-include={ffi_c-dir}/include
–with-ffi_c-lib
–without-ffi_c-lib=${ffi_c-dir}/lib
–enable-system-libffi
–disable-system-libffi
–with-libffi-config
–without-libffi-config
–with-pkg-config
–without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/mkmf.rb:467:in `try_do’: The compiler failed to generate an executable file.

There have been multiple threads on this, but as a new user you probably don’t realise the forum search option is awful. Do a search in Google instead and include “unity forum” at the start of what you search for.

Anyway, this is what helped solve the problem for me: CocoaPods installation failure while building Unity project for iOS. – Shobhit Samaria

Thank you I’ll try that. I appreciate your help.

So did you check the log file? Maybe you’re missing a necessary library.