Skip to main content

'bcrypt' gem install Error

Rails • Asked by Jayden Bamberger
So, I was attempting to install the gem 'bcrypt' and I received the following error:
Installing bcrypt 3.1.11 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.

current directory:
/tmp/bundler20180227-14591-12ywl1kbcrypt-3.1.11/gems/bcrypt-3.1.11/ext/mri
/usr/bin/ruby2.3 -r ./siteconf20180227-14591-1t2kx3l.rb extconf.rb
mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h

extconf failed, exit code 1

Gem files will remain installed in
/tmp/bundler20180227-14591-12ywl1kbcrypt-3.1.11/gems/bcrypt-3.1.11 for
inspection.
Results logged to
/tmp/bundler20180227-14591-12ywl1kbcrypt-3.1.11/extensions/x86_64-linux/2.3.0/bcrypt-3.1.11/gem_make.out

An error occurred while installing bcrypt (3.1.11), and Bundler cannot
continue.
Make sure that `gem install bcrypt -v '3.1.11'` succeeds before bundling.
 I've already tried looking it up countless times and many of the answers on other websites weren't working. So if anyone is able to help, please do.

It looks like you are missing some development packages or dependencies.


sudo apt-get install ruby-dev
 

Are you on a mac? You may also need the command line tools. 

brew doctor can help in these situations.

Thank you so much! @William Kennedy Your suggestion helped a lot. The gem installed and is now working. Thanks!

Your welcome but I think it was you who did all the work. Glad it's working. 

Login or Create An Account to join the conversation.

Subscribe to the newsletter

Join 24,647+ developers who get early access to new screencasts, articles, guides, updates, and more.

    By clicking this button, you agree to the GoRails Terms of Service and Privacy Policy.

    More of a social being? We're also on Twitter and YouTube.