Ruby 2.0 をインストール (for Windows)

0. 準備

rubyそのものと、拡張ライブラリのコンパイル環境を準備しておく。

  • rubyinstaller-2.0.0-p0.exe
  • DevKit-tdm-32-4.5.2-20111229-1559-sfx.exe

RubyInstaller for Windows

1. Rubyをインストール

rubyinstaller-2.0.0-p0.exeを実行すると、インストールが始まる。

セットアップに使用する言語の選択 -> [日本語]
インストール先とオプションの指定
インストール先: C:\Users\foo\opt\Ruby200
    [Ruby の実行ファイルへ環境変数 PATH を設定する] のみチェック

インストールを確認

C:\Users\foo>ruby -v
ruby 2.0.0p0 (2013-02-24) [i386-mingw32]

3. 開発キットをインストール

2.1. 解凍する

DevKit-tdm-32-4.5.2-20111229-1559-sfx.exeを実行する。解凍先のディレクトリを指定する

2.2. 2.1. のファイルをインストールしたい場所へコピーする

2.3. インストールする

C:\Users\foo\opt\Ruby200\devkit>ruby dk.rb

Configures an MSYS/MinGW based Development Kit (DevKit) for
each of the Ruby installations on your Windows system. The
DevKit enables you to build many of the available native
RubyGems that don't yet have a binary gem.

Usage: ruby dk.rb COMMAND [options]

where COMMAND is one of:

  init     prepare DevKit for installation
  review   review DevKit install plan
  install  install required DevKit executables

and 'install' [options] are:

  -f, --force  overwrite existing helper scripts

C:\Users\foo\opt\Ruby200\devkit>ruby dk.rb init
[INFO] found RubyInstaller v2.0.0 at C:/Users/foo/opt/Ruby200

Initialization complete! Please review and modify the auto-generated
'config.yml' file to ensure it contains the root directories to all
of the installed Rubies you want enhanced by the DevKit.

C:\Users\foo\opt\Ruby200\devkit>ruby dk.rb review
Based upon the settings in the 'config.yml' file generated
from running 'ruby dk.rb init' and any of your customizations,
DevKit functionality will be injected into the following Rubies
when you run 'ruby dk.rb install'.

C:/Users/foo/opt/Ruby200

C:\Users\foo\opt\Ruby200\devkit>ruby dk.rb install
[INFO] Updating convenience notice gem override for 'C:/Users/foo/opt/Ruby200'
[INFO] Installing 'C:/Users/foo/opt/Ruby200/lib/ruby/site_ruby/devkit.rb'