Setting up Bcrypt for Rails on Windows

Date Posted: October 11, 2016, 11:03 am

You probably end up here because you are looking for a way to install bcrypt in your Windows machine. I needed bcrypt for authentication in my Rails application, I struggled a little bit trying to get it working on rails latest version. You might have a similar error on your console like the one bellow:

C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-4.0.0/lib/active_support/depen dencies.rb:228:in

require': 126: The specified module could not be found. - C :/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-ruby-3.1.11-x64-mingw32/lib/ (LoadError)</span></em>

Let's fix that.

<strong>Note</strong>: This tutorials is using gems 2.3.0 at the time it was created, which might be different from the current version that you are using. You can simply change ALL "2.3.0" on the commands I used for this tutorial to the version you are currently using.
    <li>Make sure you have the latest version of Ruby installed on your computer. You can download Ruby for Windows from this link: <a href=""></a></li>
    <li>Next is you need to navigate to your rails application then open up your Gemfile and uncomment  <strong>gem 'bcrypt'</strong></li>
    <li>Then run <strong>bundle install</strong> from your terminal to install the bcrypt dependecy.</li>
    <li>If you are currently utilizing bcrypt in your application, when you run using <strong>rails server </strong>you will get an error similar to the error code bellow:
    <li><span style="color: #800000;"><em>C:/Ruby23-x64/lib/ruby/gems/2.3.0/gems/activesupport-4.0.0/lib/active_support/depen dencies.rb:228:in

require’: 126: The specified module could not be found. – C :/Ruby23-x64/lib/ruby/gems/2.3.0/gems/bcrypt-ruby-3.1.11-x64-mingw32/lib/ (LoadError)

  • CD to your gem directory:  C:\Ruby23-x64\lib\ruby\gems\2.3.0\gems\bcrypt-3.1.11-x64-mingw32\ext\mri
  • Run ruby extconf.rb
  • Run make
  • Run make install 
    • This command will generate
  • Copy the generated file “” to C:\Ruby23-x64\lib\ruby\gems\2.3.0\gems\bcrypt-3.1.11-x64-mingw32\lib\2.3
    • If the folder “2.3” (or whatever version you are using)  is not present, simply create it then paste the file “” in it.
  • Restart rails, you will see that the (LoadError) message is gone.
  • Congratulations, you just have configured bcrypt in your Windows machine.
  • If you are experiencing problems with the command: make being unrecognized in your terminal –  it means you do not have DevKit installed in your Windows machine. You can follow the tutorial bellow to install DevKit and associate it with your Ruby installation.

    1. Download DevKit from here:
    2. Extract the contents of DevKit, preferably under “C:/RubyDevKit”
    3. cd C:\RubyDevKit
    4. ruby dk.rb init
    5. ruby dk.rb install
    6. devkitvars.bat
      • This command will register all DeKit variables to your Windows environment variables path.

    About author

    Carl Victor Fontanos

    A fine gentleman specializing in front-end and back-end development with extensive experience building high performance web applications that keeps users engaged and help businesses grow.

    Hire Me