no such file to load -- bcrypt_ext (via devise)

wiemann picture wiemann · Oct 10, 2010 · Viewed 10.9k times · Source

I'm using database authentication in devise(current gem) on rails 3 and I get the following error when trying to log in with username/password.

no such file to load -- bcrypt_ext 

This error occurred while loading the following files:
   bcrypt
   bcrypt_ext

I have previously "Successfully installed bcrypt-ruby-2.1.2" gem.

Any ideas? I also tried giving bundler the git repo address and fetching the master, but it doesn't solve the issue.

Answer

Jared Friedman picture Jared Friedman · Oct 17, 2011

I had this problem as well. When I installed the gem, the output told me

Building native extensions.  This could take a while...
Successfully installed bcrypt-ruby-3.0.1

so I assumed that it had, in fact, built native extensions. But when I went hunting in .../gems/bcrypt-ruby-2.1.4/ext/mri I saw that it not appear to have built anything.

I manually went in and ran

cd [path to your gems folder]/gems/bcrypt-ruby-2.1.4/ext/mri
ruby extconf.rb
make
sudo make install

This did the trick for me.