-1

I've created a project from scratch and added the firebase dependency:

dependencies:
  flutter:
    sdk: flutter


  # The following adds the Cupertino Icons font to your application.
  # Use with the CupertinoIcons class for iOS style icons.
  cupertino_icons: ^1.0.2
  firebase_core: ^2.10.0

then, I've tried to run the project with no further actions and this happens:

    LoadError - 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 'arm64')),
    '/System/Volumes/Preboot/Cryptexes/OS/Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle' (no such file), '/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
    'arm64')) - /Library/Ruby/Gems/2.6.0/gems/ffi-1.15.5/lib/ffi_c.bundle

I've found a similar problem among the issues of the official project, but I can't fix it myself, although the issue looks very similar. What step should I follow to fix this?

Bertuz
  • 2,390
  • 3
  • 25
  • 50
  • Stack Overflow isn't a very good place to file a bug report. If you think this is a bug in something outside your code, I suggest spending some time gathering information and debugging, and posting your results to one of the existing reports (or file a new one) so that the maintainers have helpful information more to work with. – Doug Stevenson Apr 24 '23 at 02:13
  • Not sure it’s a bug in the first place – Bertuz Apr 24 '23 at 09:49
  • So what do you think you might have done wrong? – Doug Stevenson Apr 24 '23 at 12:25
  • 1
    That's an older version if Ruby - you may have outdated libraries or a number of other issues. Please ensure everything is up-to-date. – Jay Apr 25 '23 at 17:23

1 Answers1

1

I ran into a similar error when doing 'pod install' and fixed it by installing newer ruby version (3.0.0). You might be using the default ruby installed in MacOS. Enter command 'which ruby' and 'ruby -v' to check which ruby is being used.

To ensure the newer ruby is being used, install a ruby version manager like rvm and follow their instruction to install ruby.

Quoting this answer:

Install Ruby via RVM

Install RVM as per instructions || as per this

rvm install (ruby version)

rvm --default use (ruby version)

can use rvm list to see available ruby versions.

Trong Nguyen
  • 368
  • 2
  • 12