Search code examples
flutterfirebaseandroid-studiococoapods

Error "To set up CocoaPods for ARM macOS, run: arch -x86_64 sudo gem install ffi Unable to solve error"


Cocoa pods error in Android Studio on M1 Mac in Flutter. Need help fixing this error. I have tried other methods online but none have helped. I have even re-installed with HomeBrew, but no help.

[✓] Flutter (Channel stable, 3.0.3, on macOS 12.2.1 21D62 darwin-arm (Rosetta),
    locale en-US)
[✓] Android toolchain - develop for Android devices (Android SDK version 33.0.0)
[✓] Xcode - develop for iOS and macOS (Xcode 13.4.1)
[✓] Chrome - develop for the web
[✓] Android Studio (version 2021.2)
[✓] Connected device (3 available)
[✓] HTTP Host Availability

• No issues found!

Error: To set up CocoaPods for ARM macOS, run:
  arch -x86_64 sudo gem install ffi

Error running pod install
Error launching application on iPhone 13.

dlopen(/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle, 0x0009): tried: '/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e')), '/usr/lib/ffi_c.bundle' (no such file) - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle (LoadError)

Solution

  • Run this commands in terminal

    arch -x86_64 sudo gem install ffi

    Then inside the ios folder of your project run this command

    arch -x86_64 pod install