Search code examples
ruby-on-railsrubygemsbcrypt-ruby

bcrypt-ruby gem Gem::Installer::ExtensionBuildError:


Good day. I'm trying to set up project that's beings worked on by other people.
when i run bundle install it crashes with an error

Installing bcrypt-ruby (3.0.1) with native extensions 
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb 
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:36:in `<main>'


Gem files will remain installed in /home/halfros/.bundler/tmp/9279/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /home/halfros/.bundler/tmp/9279/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out
An error occurred while installing bcrypt-ruby (3.0.1), and Bundler cannot continue.
Make sure that `gem install bcrypt-ruby -v '3.0.1'` succeeds before bundling.

sudo gem install bcrypt-ruby -v '3.0.1'

$ sudo gem install bcrypt-ruby -v '3.0.1'
Building native extensions.  This could take a while...
ERROR:  Error installing bcrypt-ruby:
    ERROR: Failed to build gem native extension.

        /usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
    from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
    from extconf.rb:36:in `<main>'


Gem files will remain installed in /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.0.1 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/bcrypt-ruby-3.0.1/ext/mri/gem_make.out

Tried ths - no changes.
http://rorguide.blogspot.com/2011/02/bundle-install-on-linux-giving-error.html


Solution

  • It looks like the ruby development library isn't installed.

    It also looks like you're using global ruby/gems installation, so your easiest fix is to install the ruby1.9-dev package (or something similar), and try again.

    Alternatively, you could use rvm and this problem will fix itself: https://rvm.io/