Search code examples
react-nativemacoscocoapodsffi

Failed sudo arch -x86_64 gem install ffi


In my react native app, I tried to install ffi using "sudo arch -x86_64 gem install ffi" but it's always failed and return following error.

ERROR:  Error installing ffi:
        ERROR: Failed to build gem native extension.

current directory: /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/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 ./siteconf20221214-80226-arassj.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.

I'm using MacBook Air M1 2020


Solution

  • https://github.com/ffi/ffi/issues/286 Check this document it might be help you and also try this command:

    brew install cocoapods