(mach-o file, but is an incompatible architecture (have (arm64), need (x86_64)) on apple M1 chip

internal:/Users/zhanglinjie/.asdf/installs/ruby/3.1.4/lib/ruby/site_ruby/3.1.0/rubygems/core_ext/kernel_require.rb:38:in `require': dlopen(/Users/zhanglinjie/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/prometheus-client-mmap-1.0.0/lib/fast_mmaped_file_rs.bundle, 0x0009): tried: '/Users/zhanglinjie/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/prometheus-client-mmap-1.0.0/lib/fast_mmaped_file_rs.bundle' (mach-o file, but is an incompatible architecture (have (arm64), need (x86_64))) - /Users/zhanglinjie/.asdf/installs/ruby/3.1.4/lib/ruby/gems/3.1.0/gems/prometheus-client-mmap-1.0.0/lib/fast_mmaped_file_rs.bundle (LoadError)

versions:

  • ruby: 3.1.4
  • prometheus-client-mmap: 1.0.0
  • system: macOS 12.7.1
  • GDK: installed in Rosetta2 terminal