Search code examples
flutterflutter-ios

How can solve this problem? Error: To set up CocoaPods for ARM macOS, run: arch -x86_64 sudo gem install ffi


Updated context:

When I tried to run flutter project, but I got the this error Error: To set up CocoaPods for ARM macOS, run: arch -x86_64 sudo gem install ffi

I'd run arch -x86_64 sudo gem install ffi, but still had same issues.

this is information

yomate@Mac-mini yomate % sudo gem install ffi
/System/Library/Frameworks/Ruby.framework/Versions/2.6/usr/lib/ruby/2.6.0/universal-darwin21/rbconfig.rb:230: warning: Insecure world writable dir /Users/yomate/FlutterDev/flutter/bin in PATH, mode 040777
Building native extensions. This could take a while...
Successfully installed ffi-1.15.5
Parsing documentation for ffi-1.15.5
Done installing documentation for ffi after 3 seconds
1 gem installed

How can solve this problem? arch: posix_spawnp: gem: Bad CPU type in executable , environment: Mini M1

When I want to use this commend

sudo arch -x86_64 gem install ffi and sudo arch -x86_64 gem install cocoapods

I had got this error. arch: posix_spawnp: gem: Bad CPU type in executable

And my flutter still had error.

[!] Flutter (Channel stable, 3.0.1, on macOS 12.4 21F79 darwin-arm, locale
    en-AU)
    ✗ Downloaded executables cannot execute on host.
      See https://github.com/flutter/flutter/issues/6207 for more information

Solution

  • try with this
    sudo gem uninstall ffi && sudo gem install ffi -- --enable-libffi-alloc
    source