Tuesday, August 31, 2010

Can not install Devise gem with Ruby 1.9.2 on windows

I was having a try out of devise gem with one of my Rails 3 pet project just yesterday. I installed Ruby 1.9.2 with the one-click installer from rubyinstaller.org and the latest Rails 3.0. But I faced installation problem as usual on windows. The problem was that it was not being able to build its native extensions.

After some research I found out the solution at http://github.com/oneclick/rubyinstaller/wiki/development-kit. What I was missing is development kit. I just followed the instruction and it was solved and installed devise with my Ruby 1.9.2 correctly.

But I am not sure whether it will work with Rails 3's bundle install command or not. I installed the gem from command line using the command gem install devise --platform=ruby before installing all the required gems with bundle install command . The last parameter platform is a must as it will temporarily use the DevKit to build native extensions. That's it.

5 comments:

  1. Thank you Ashif for taking the time to document install of Devise gem on Windows.

    Dennis Major

    ReplyDelete
  2. You are welcome Dennis. My pleasure...

    ReplyDelete
  3. Thank you very much, this was extremely helpful.

    ReplyDelete
  4. Ashif, Thanks for your post. I have tried following the steps here and run into a problem making the gem. I know this isn't a forum but perhaps you will be able to point me in the right direction.
    I am also on Ruby 1.9.2, Rails 3.0.2, Windows 7. I have both cygwin and the developer kit, and am able to install other gems successfully. Here is what I get when I try the above for devise:

    c:\>gem install devise --platform==ruby
    Temporarily enhancing PATH to include DevKit...
    Building native extensions. This could take a while...
    ERROR: Error installing devise:
    ERROR: Failed to build gem native extension.

    C:/Ruby192/bin/ruby.exe extconf.rb
    creating Makefile

    make
    make: *** No rule to make target `/C/Ruby192/include/ruby-1.9.1/ruby.h', needed
    by `bcrypt.o'. Stop.


    Gem files will remain installed in C:/Ruby192/lib/ruby/gems/1.9.1/gems/bcrypt-ru
    by-2.1.2 for inspection.
    Results logged to C:/Ruby192/lib/ruby/gems/1.9.1/gems/bcrypt-ruby-2.1.2/ext/mri/
    gem_make.out

    c:\>

    Any thoughts on what would cause this?

    Many thanks and kind regards,

    -Sam

    ReplyDelete
  5. Hello Sam, sorry for the late reply. Been out for a vacation trip. Interesting that you are facing the issue as I followed the following installation steps for the devkit. Can you please follow the steps and let me know your result:

    * Extract the DevKit-4.5.0-20100819-1536-sfx.exe to a suitable location and cd on command prompt
    * now run the command: ruby dk.rb init and it will build a config.yml to that directory. Edit the config.yml file and comment out the line for the ruby versions for which you don't want to use the latest version of devkit. If you don't find the ruby installation directory you want to add, then you can add here as the example shown there.
    * now check the installation configuration using the command: ruby dk.rb review
    * And finally run the command: ruby dk.rb install
    If all the steps are completed successfully then use the command: gem install devise --platform=ruby

    Please let me know if you are still facing the issue.

    Thanks,
    Ashif

    ReplyDelete