1. Computing

Ruby on Windows the Easy Way: With Linux

Running Linux on a Virtual Machine for Ruby Development

By

Ruby on Windows the Easy Way: With Linux

Linux is one of the most natural, fitting choices for a Ruby development environment. Next to OS X, it provides the least resistance and has the most tools out of the box to get the job done. However, running Linux as your primary OS has its own challenges. This can range from drivers not working correctly, driver regressions in newer kernel versions, the inability to run Windows programs, etc. While it does work just fine for many, Linux is not suitable for a primary OS for other.

Why not Windows?

It is entirely possible to run Ruby on Windows. However, the Windows ports of Ruby, of the related tools and libraries, of pretty much everything end up being second rate. It seems to work fine at first but at some point you will run into problems.

And then there's the command-line environment. Where on Linux you get a rich, extremely powerful and familiar command line environment absolutely filled with tools that will be useful at every step of the way, Windows is just... barren. A terminal emulator that's incapable of simple tasks, no tabs, difficult to copy and paste, bad line editor, etc. And the lack of tools like grep, sed, find, etc. This can be fixed by installing a bash interpreter on Windows, but this falls prey to the point above, at some point you're really going to run into something that crashes or doesn't work. The experience will always be second to what Linux gives you.

Virtualization

The easiest solution to the quandary of wanting to run Windows but develop on Linux is virtualization. You can install Linux on top of Windows and run them side by side. You can even have the windows co-exist (mostly) peacefully, and reap the benefits of both operating systems. And the best part is, it's all free and modern CPUs have acceleration features that make this quite fast. There are several solutions that implement a virtualization environment, but we'll be going with VirtualBox.

Three Steps

This tutorial is broken into three steps.

  • Choosing a Distro and Installing - There are more Linux distros than craters of the moon (or at least it seems that way) and making a choice of which distro to use if you're unfamiliar with Linux can be daunting. This article will talk about choosing a distro and walk you through (roughly) installing Linux on VirtualBox. You'll also need to install the VirtualBox tools on the guest operating system to enable things like shared folders and clipboard integration.

  • Installing Ruby - Now that you have Linux up and running, you need to install Ruby. There are multiple ways of going about this (using your distro's binary packages, compiling yourself, etc), but we'll be using RVM. At the end of this step, you'll have everything you need as far as Ruby is concerned.

  • Version Control, Editors and Environment - You're almost there. It's time to set up Git (or another version control system, if you wish), your favorite editor and command line environment. While this step is highly subjective (everyone has their own idea of what is the "right" software to use here), this tutorial will cover setting up Git, Vim and Zsh.

How to Use Linux?

If you're unfamiliar with Linux in general and need help getting around, the About.com Guide to Linux is a good place to start. Linux can be a daunting, confusing and downright befuddling experience if you're used to Windows and IDEs. And while you don't need to become a *nix guru to use Linux, you should have a basic understanding of the command line environment, how to formulate pipelines and use the basic command line tools and how to use your distributions package manager.

  1. About.com
  2. Computing
  3. Ruby
  4. Tutorials
  5. Ruby on Windows the Easy Way
  6. Ruby on Windows the Easy Way: With Linux

©2014 About.com. All rights reserved.