Ruby on Windows

Ruby on Windows

Rails (shortened of Ruby on Rails) is an full-stack web application framework for Ruby. RubyGems is Ruby’s premier packaging system. DevKit is a toolkit that makes it easy to build and use native C/C++ extensions for Ruby on Windows. Bundler manages an application’s dependencies Rake (like Make) provides a simple build program with capabilities similar to make. Tcl/Tk toolkit libraries are required to develop GUI applications in Ruby. RVM is Ruby Version Manager to manage multiple versions of Ruby. Windows Counterpart of RVM is Pik:

rbenv is the new best version manager. Until recently, RVM was the best choice. It certainly helped with managing multiple versions of Ruby but it is a mess of bash scripts that are far more invasive than I care for. Fortunately, Sam Stephenson’s rbenv and ruby-build offer a much more elegant and efficient way to manage your Ruby installs.

sstephenson/rbenv · GitHub fesplugas/rbenv-installer · GitHub

Ruby and RubyGems

Ruby is needed if we want to use Veewee to create your Vagrant baseboxes.

Download and install Ruby Installer for Windows. The installer already includes RubyGems. :: Downloads Tutorials · oneclick/rubyinstaller Wiki

You access this command prompt from the Windows Start menu (All Programs > Ruby (version) > Start Command Prompt with Ruby).

Update RubyGems from the Ruby Command Prompt: gem update –system

Install: RubyInstaller: Install in “c:\Ruby” and select only “Add Ruby executables to PATH” (C:\Ruby\bin). Now we have a “gem” command.

Repository of Gems: :: all gems | | your community gem host


First of all: we don’t need Rails on Windows. So, don’t install with whis installer. :: RailsInstaller :: Rails Development on Windows. Seriously.

Do not use this as it doesn’t ask you anything and installs everything. Ruby, Rails, Bundler, Git, TinyTDS, SQL Server support, DevKit, Sqlite I already have Git, and I don’t need the rest (except DevKit).


If you ever need multple Ruby version manager, install Pik simple as this:

gem install pik pik_install %SYSTEMDRIVE%\Pik SET PATH=%SYSTEMDRIVE%\Pik;%PATH%

And test with: pik list

Sources: :: vertiginous/pik · GitHub :: PIK: Multiple Ruby versions for Windows | grzegorz

Installing Ruby (and RubyGems) on Windows

Ruby GEM Environment Variables :: gem Command Reference | RubyGems Manuals :: Installing gems in a non-standard directory :: ruby - RUBYLIB Environment Path - Stack Overflow

export GEM_HOME="$HOME/.gems" export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8" export PATH="$HOME/.gems/bin:$PATH"

You have to redefine the location of the GEM_HOME variable and add the paths to the gem repositories in the RUBYLIB variable before launching the installation into a custom directory.

GEM_HOME should point to $PREFIX/lib/ruby/gems/1.8 if it used with the 1.8 version of ruby.

RUBYLIB should point to the $PREFIX/lib/ruby and $PREFIX/lib/site_ruby/1.8

GEM_PATH provides the locations where gems can be found, GEM_HOME is where gems will be installed (by default)

Two ENV variables control the ‘gem’ command:

GEM_HOME: the single path to a gem dir where gems are installed

GEM_PATH: a standard PATH to gem dirs where gems are found

export GEM_HOME=$HOME/.gems export PATH=$GEM_HOME/bin:$PATH


<% if node[:platform] != “windows” -%>

Export gem paths so that we use the isolated gems.

export GEM_PATH=${EMBEDDED_DIR}/gems export GEM_HOME=${GEM_PATH}

<% if node[:platform] == “windows” -%> VAGRANT_EXECUTABLE=${EMBEDDED_DIR}/bin/vagrant

According to the documentation of your shell,

set GEM_PATH to gem env gempath with ~/gems added set GEM_HOME to ~/gems

Colon (:) sign in GEM_PATH is simply a separator (semi-colon on windows).

export GEM_HOME="$RUN/.gems" export GEM_PATH="$GEM_HOME:/usr/lib/ruby/gems/1.8" export PATH="$RUN/.gems/bin:$PATH" export RUBYLIB="$RUN/lib:$RUBYLIB"

RubyGem / GEM Commands

Uninstall a GEM, specific version: gem uninstall vagrant -v 0.7.8

List all GEMs: gem list

Show environment: gem environment or shortened: gem env

Show specific environment variable: gem env gempath

Notice the difference between “vagrant gem env” and “gem env”.

Source: :: Command Reference - RubyGems Guides

RubyGems Configuration Options

I’m sure I don’t need any of RI or RDoc from the Gems. If you want to permanently disable installing them, type this (Windows 7):

echo gem: –no-ri –no-rdoc > %PROGRAMDATA%\gemrc

Articles: :: ruby - How to make –no-ri –no-rdoc the default for gem install? - Stack Overflow :: Skiping installation of ri and RDoc documentation while installing gems | WebOnRails

Learning Ruby Read Ruby 1.9: Free Ebook About the Ruby Programming Language

Speed up Ruby

rdp/faster_require · GitHub

gem install faster_require

yari = Best way to install Ruby on Windows

Use yari instead of RVM/rbenv.

Yet Another Ruby Installer scottmuc/yari · GitHub

yari will download and configure ruby to wherever you clone the yari. It will then modify your PATH so that the ruby version chosen will be used.

  1. Set Up Git · github:help 2.

Speed up Ruby 2nd Turn

set PATH=c:\Tools\Ruby193-TheCodeShop\bin;%PATH% set RUBYOPT=-rfenix/replace

I decided for: tcs-ruby193_require_fenix_gc_hash_20120527.7z Downloads · thecodeshop/ruby Wiki

There exists a project called The Code Shop, which tries to solve the Ruby performance problem on Windows. It makes different builds available to download, each experimenting with different set of patches. I can recommend tcs-ruby193_require_winio_fenix-20111113 because it seems to be the fastest.

Speedup Ruby 1.9.3 On Windows The Code Shop

date 01. Jan 0001 | modified 29. Dec 2023
filename: Ruby - Windows