Services Spotlight:

Install Ruby DevKit on Windows 7

Written By Corlew Solutions
Updated August 1, 2014
Published August 1, 2014
Why Corlew Solutions?

We write great software and provide amazing technical support. Contact us today if you need help with a software project:

Article Technology Info

This article discusses the following technologies:

  • Ruby DevKit - A toolkit that makes it easy to build and use native C/C++ extensions for Ruby on Windows.
    (website | download | docs | wiki)

Introduction

Installing gems on Windows can be problematic. Some Gem authors provide binary gems that are compatible with Windows, but others assume the Gem will be compiled during install time on a “sane” development environment (a.k.a an environment that has *nix build tools available like make, gcc and sh). Since Windows isn’t typically setup to handle building and compiling these gems, it can be difficult to install gems which need to be compiled.

Thankfully, the RubyInstaller team created the DevKit to solve this problem. It helps makes Windows a sane environment for building gems.

Step 1: Download the DevKit

Head over to the Ruby Installer downloads page and grab the DevKit .exe file that matches the version of Ruby being used on the machine. If you need to find the version of Ruby, open a terminal and run:

1
ruby -v

If x64 appears in the output, 64bit Ruby has been installed. If x86 appears in the output, 32bit Ruby has been installed.

Step 2: Install the DevKit (Basic)

The information in this section is taken from the DevKit Installation Instruction Page. Those directions contain some extra information if you need to do more advanced configuration.

Extract the Files

  • Double click on the downloaded file.
  • When asked where to extract, enter a path with no spaces. C:\DevKit is HIGHLY recommended (or another path that does not contain a folder name with spaces).

DO NOT rename the directory after the files have been extracted; the path has been hard coded into the Ruby installation. The rest of these directions assume the files were extracted to C:\DevKit.

Run Installation Scripts

Open a terminal, and run:

1
2
3
cd c:\DevKit
ruby dk.rb init
ruby dk.rb install

If you get an error stating “Invalid configuration”, checkout this stackoverflow thred which explains fixing the config.yml and rerunning ruby dk.rb install.

Step 3: Test the DevKit Installation

To test the DevKit installation, we will try to install the JSON gem. Open a terminal and run:

1
gem install json --platform=ruby

The JSON gem should install correctly and you should see a message about Building native extensions. Next, let’s actually use the JSON run and run:

1
ruby -rubygems -e "require 'json'; puts JSON.load('[42]').inspect"

If everything worked correctly, the screen should show:

1
# [42]

We hope you found this article useful. If you see any mistakes, missing features or ways to improve it, please let us know in the comments below so we can update its contents. If you're willing to link to us, we would sincerely appreciate it!

Corlew Solutions is a Web Design and Web Application Development company based in Fairfax Virginia, minutes away Washington D.C. If you're looking for great web design from the Northern Virginia area or web design from the Washington D.C. area we can help. Contact Us today!

comments powered by Disqus