Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

I can't use bcrypt on Apple M1 Chip #239

Open
helosshi opened this issue Dec 27, 2020 · 4 comments
Open

I can't use bcrypt on Apple M1 Chip #239

helosshi opened this issue Dec 27, 2020 · 4 comments

Comments

@helosshi
Copy link

Specs

  • MacBook Air(Apple M1 Chip)
  • macOS 11.1
  • ruby 2.7.2p137 (2020-10-01 revision 5445e04352) [arm64-darwin20]
  • bcrypt (3.1.16)

Details

When I try require 'bcrypt' by irb.

I got this error.

irb(main):001:0> require 'bcrypt'
Traceback (most recent call last):
       10: from /Users/helosshi/.rbenv/versions/2.7.2/bin/irb:23:in `<main>'
        9: from /Users/helosshi/.rbenv/versions/2.7.2/bin/irb:23:in `load'
        8: from /Users/helosshi/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/irb-1.2.6/exe/irb:11:in `<top (required)>'
        7: from (irb):1
        6: from /Users/helosshi/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:156:in `require'
        5: from /Users/helosshi/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:168:in `rescue in require'
        4: from /Users/helosshi/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:168:in `require'
        3: from /Users/helosshi/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bcrypt-3.1.16/lib/bcrypt.rb:12:in `<top (required)>'
        2: from /Users/helosshi/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
        1: from /Users/helosshi/.rbenv/versions/2.7.2/lib/ruby/2.7.0/rubygems/core_ext/kernel_require.rb:92:in `require'
LoadError (dlopen(/Users/helosshi/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bcrypt-3.1.16/lib/bcrypt_ext.bundle, 9): no suitable image found.  Did find:)
        /Users/helosshi/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bcrypt-3.1.16/lib/bcrypt_ext.bundle: mach-o, but wrong architecture
        /Users/helosshi/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bcrypt-3.1.16/lib/bcrypt_ext.bundle: mach-o, but wrong architecture - /Users/helosshi/.rbenv/versions/2.7.2/lib/ruby/gems/2.7.0/gems/bcrypt-3.1.16/lib/bcrypt_ext.bundle

I search this error, but I can't found how to fix.
And I ask this error to my mentor, but he also can't resolved this error.

So, I make this issue.
please give me advise.
thanks.

@mscwilson
Copy link

I am having the same problem.

@trouni
Copy link

trouni commented Feb 23, 2021

Got this solved by first uninstalling bcrypt with gem uninstall bcrypt, then bundle install (or gem install bcrypt).

@elviajero971
Copy link

Got this solved by first uninstalling bcrypt with gem uninstall bcrypt, then bundle install (or gem install bcrypt).

I've got the same issue but couldn't resolve it with your tips...

@wmcraver
Copy link

I'm not sure if this will solve the issue for everyone, but when I was doing some searching, I ran across someone having a similar issue on protocolbuffers. They mentioned that the error was related to the gem missing the arm64 binaries for the extensions.

I ran gem install bcrypt --platform=ruby and was able to use the BCrypt gem without issue in my test rails app and in rails console.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants