Setting up Ruby for Windows and installing RubyGems

I’m going to cover a few different topics here, none of them in great detail but enough to get you started. You’ll find more than enough in-depth articles on using Ruby or any of the many RubyGems available out there such as Middleman – this is just to get you off the ground.

ruby-install-windows

I started with a Windows 7 64-bit laptop – nothing installed. I needed to get to the point where I could install gems, which is easy enough but there are a few steps to work through. These steps assume you have administrator rights to install programs. In addition to these instructions, you may find the articles on About.com helpful.

Step 1 – Download and install Github (optional) This is only required if you use Github to manage the development of your Ruby website, otherwise skip this step. Github is one of the most user-friendly version control systems out there. Create an account, setup a repo (repository) and start building!

To install on Windows, simply download the installer and follow the prompts. The first time you use it you’ll need to log in with your account details and sync (to copy your repo to your local drive).

Step 2 – Install Ruby for Windows – Once again straightforward enough. Grab the latest build of RubyInstaller for Windows and install. My suggestions are always accept the default install directory (e.g. C:\Ruby193 – we will use this as our example) and select the options to make Ruby available system-wide.

Step 3 – Install the Ruby Devkit – This is needed for running a lot of the native C/C++ extensions (sorry if you thought you could get away with just a light Ruby install!). Download the self-extracting zip file and extract to the C:\Ruby193\devkit folder.

Step 4 – Initialise and install the dk.rb file – Open a command window (Windows key > R, type cmd and press Enter), navigate to the folder that contains the dk.rb file (e.g. type cd C:\Ruby193\devkit) then type ruby dk.rb init to initialise the devkit. This creates a config.yml (YAML file) – it should have the correct folder for your Ruby installation but check anyway. If it’s correct type ruby dk.rb install and press Enter.

config-yaml-file

It’s probably a good idea at this point to restart your machine.

You should now be all set to install or run RubyGems. RubyGems are most likely already installed with Ruby for Windows but you can make sure they’re all up-to-date by typing gem update –system.

If you have any issues with installing gems maybe try a different devkit version.

If you run into any issues getting started or installing gems let me know in the comments section.

Posted in Technical Tips and tagged , , , , .

Leave a Reply

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

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>