Skip to content

System use arm64-darwin ( Apple silicon ), but got *-x86_64-darwin.gem #9

@koten0224

Description

@koten0224

Use this following command to install Mongory:

gem install mongory -v 0.7.8 --platform arm64-darwin

When use MacOS, run
gem install mongory
and require mongory in ruby:
require 'mongory'
got error:

Mongory C extension is disabled because mongory_ext is not loaded: 
dlopen(/Library/Ruby/Gems/2.6.0/gems/mongory-0.7.8-x86_64-darwin/lib/core/2.6/mongory_ext.bundle, 0x0009): 
tried: '/Library/Ruby/Gems/2.6.0/gems/mongory-0.7.8-x86_64-darwin/lib/core/2.6/mongory_ext.bundle' 
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')), 
'/System/Volumes/Preboot/Cryptexes/OS/Library/Ruby/Gems/2.6.0/gems/mongory-0.7.8-x86_64-darwin/lib/core/2.6/mongory_ext.bundle' (no such file), 
'/Library/Ruby/Gems/2.6.0/gems/mongory-0.7.8-x86_64-darwin/lib/core/2.6/mongory_ext.bundle' 
(mach-o file, but is an incompatible architecture (have 'x86_64', need 'arm64e' or 'arm64')) 
- /Library/Ruby/Gems/2.6.0/gems/mongory-0.7.8-x86_64-darwin/lib/core/2.6/mongory_ext.bundle

POV: have 'x86_64', need 'arm64e' or 'arm64'

The root cause is the platform of Ruby 2.6 is universal-darwin24

> ruby -e 'puts RUBY_PLATFORM; require "rbconfig"; puts RbConfig::CONFIG["arch"]; p Gem.platforms'
->
universal.arm64e-darwin24
universal-darwin24
["ruby", #<Gem::Platform:0x0000000136821478 @cpu="universal", @os="darwin", @version="24" @cpu="universal", @os="darwin", @version="24">]

This platform will be explained as x86_64-darwin by Rubygem

You need to install it with specific platform

gem install mongory -v 0.7.8 --platform arm64-darwin

Or install via Gemfile:

gem 'mongory'

and run the following command

bundle config set specific_platform true
bundle lock --add-platform arm64-darwin

You will see this in your Gemfile.lock

PLATFORMS
  ruby
  arm64-darwin

and run bundle install, it will be correct

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions