0

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.

Sviat Kuzhelev
  • 1,758
  • 10
  • 28
  • Did you port your machine over from x86_64? If so, you'll need to scrub and reinstall Ruby through `rbenv`. – tadman May 31 '23 at 14:14
  • Nope, I have a clean mac. Installed via arm64. Removed and installed everything again, still same error – Sviat Kuzhelev May 31 '23 at 14:23
  • Do other versions of `stringio` work? It could be a bad build with the wrong binary baked in. – tadman May 31 '23 at 14:23
  • Tried various versions. Same issue... I believe this is something wrong on my end, I just could not figure out what exactly... – Sviat Kuzhelev May 31 '23 at 14:37
  • Worth checking your `gem env`. For what it's worth, `gem install stringio -v 3.0.6` had no issues on my machine, macOS 13.3.1, M1, Ruby 3.2.2. – tadman May 31 '23 at 14:42
  • Funny, I don't receive this error while running on top of `sudo`... why? – Sviat Kuzhelev May 31 '23 at 15:14
  • `sudo` may not be using the same `rbenv` settings and could've used the system Ruby. – tadman May 31 '23 at 15:35
  • You might be right! I think it's better not to use `sudo` as it leads to other portions of errors. Still, the original issue does not go away. – Sviat Kuzhelev May 31 '23 at 15:45
  • Does `gem env` provide any insight? There are situations where, for whatever reason, `gem` is not the one associated with your current Ruby, it's pointing to some relic. – tadman May 31 '23 at 15:51
  • Let us [continue this discussion in chat](https://chat.stackoverflow.com/rooms/253903/discussion-between-sviat-kuzhelev-and-tadman). – Sviat Kuzhelev May 31 '23 at 16:00
  • In your stacktrace output there's a reference to `/System/Volumes/Preboot/Cryptexes/OS/Users/...` - seems really odd to be referencing the Preboot volume. – smathy May 31 '23 at 22:36

1 Answers1

1

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

Sviat Kuzhelev
  • 1,758
  • 10
  • 28