Search code examples
ruby-on-railsrubyrubygemsapple-m1stringio

Stringio 3.0.6 does not execute properly with arm64 on M1 MacOS


I'm trying to install stringio 3.0.6 as a part of project dependencies tree via bundle install, but apparently it does not work as it should because of the error mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64').

The full stacktrace is below:

<internal:/Users/sviat/.rvm/rubies/ruby-3.1.2/lib/ruby/3.1.0/rubygems/core_ext/kernel_require.rb>:85:in 
`require': 
dlopen(/Users/sviat/.rvm/gems/ruby-3.1.2/gems/stringio-3.0.6/lib/stringio.bundle, 0x0009):
 tried: '/Users/sviat/.rvm/gems/ruby-3.1.2/gems/stringio-3.0.6/lib/stringio.bundle' 
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')), 
'/System/Volumes/Preboot/Cryptexes/OS/Users/sviat/.rvm/gems/ruby-3.1.2/gems/stringio-3.0.6/lib/stringio.bundle' (no such file), '/Users/sviat/.rvm/gems/ruby-3.1.2/gems/stringio-3.0.6/lib/stringio.bundle' 
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64')) - 
/Users/sviat/.rvm/gems/ruby-3.1.2/gems/stringio-3.0.6/lib/stringio.bundle (LoadError)

I'm constantly getting the error above despite I have done everything below:

  1. Set bundle config set force_ruby_platform true;
  2. Installed Ruby with ruby -v prints ruby 3.1.2p20 (2022-04-12 revision 4491bb740a) [arm64-darwin22];
  3. Using ZSH with proper config in it and source ~/.zshrc.
  4. Using ARM terminal with uname -m says arm64.
  5. I can install stingio with gem list stringio, but not with arch -arm64 gem install stringio. The error will be as above.
  6. Rozetta is not turned on in Terminal setting.

What else I can try? I've reinstalled my ruby and tried to do the same with RBENV, etc. Restarted my laptop and switched the electricity without any success.

MacOS - Ventura 13.4; Chip - M1. Ruby - 3.1.2. RVM - latest. Terminal - arm64.


Solution

  • Well by the end of the day I have fixed this up by using rvm instead of rbnev. removed all the stuff related to ruby and rbnev from my machine, reloaded PC, and installed everything on top of rvm