Getting the bcrypt-ruby and Devise gems working in Windows

Anyone who’s tried to install the Rails gem Devise on their Windows PC know that it’s not a smooth process – it takes a bit of massaging, requiring use of a development kit from the RubyInstaller For Windows website and a special parameter to be passed to the gem executable.

  1. Grab the latest version of the development kit, DevKit-4.5.0-20100819-1536-sfx.exe, from the RubyInstaller Downloads page.
  2. Run the self-extracting installer, placing all files to C:\devkit\ . Navigate to the directory and initialize the development kit by executing:
    ruby dk.rb init
  3. Review the auto-recognized paths to ensure its accuracy:
    ruby dk.rb review
  4. Finally, actually install the development kit add-ons:
    ruby dk.rb install
  5. Now we’re ready to install our problematic gems! In the same directory, execute your gem command:
    gem install devise --platform=ruby

You’ll note the include of the flag –platform=ruby in the last command listed above – it’s essential in avoiding a make issue inherent to the Windows environment. Also, bcrypt-ruby is installed as a requirement of the devise gem, so that’s two birds with one stone if you’re looking to make use of both. Enjoy!

References:

2 Comments

  1. Luis Lavena

    Hello,

    Thank you for writing this post. There has been a few changes in the way the devkit works, specially, we recommend nothing from the devkit contents is copied over the bin directory.

    Perhaps you can take a look to the updated instructions here:

    http://github.com/oneclick/rubyinstaller/wiki/Development-Kit

    Those instructions works with latest SFX packages of the DevKit and do not required stub files (like make.bat or gcc.bat) are copied to the Ruby bin directory.

    Also, it is recommended, as we discover certain tools and gems interfere with that functionality.

    Now gem installation is transparent.

    Thank you.

  2. Sully Syed

    Ah, Luis, that’s great! Leave it to me to overcomplicate what’s actually made really simple. Thanks for the tip and for the fantastic work on the RubyInstaller project!

Leave a Reply

Your email address will not be published. Required fields are marked *