@thorikiriのてょりっき

@thorikiriがWebとかAndroidとかの技術ネタや本を読んだブログです

Windows7にRails4をインストールする

Windows7にRails4をインストールしてみます。
あらかじめRuby2がインストールされていることとします。
環境

Rails4 インストール

正式リリースされているので、gem install railsでインストール出来ると思ってましたが、次のようなエラーが出ました。

> gem install rails
ERROR:  Error installing rails:
        The 'atomic' native gem requires installed build tools.

Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'

どうやら、DevelopmentKitが入っていないとダメなようですね。
なので、こちらからダウンロードします。
今回は、DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exeをダウンロードしてみた。
ダウンロードしたら、exeファイルを実行する。ディレクトリを聞かれるので、保存するディレクトリを指定する。
展開したディレクトリで、次のコマンドを実行する

> ruby dk.rb init
[INFO] found RubyInstaller v2.0.0 at C:/ruby

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.

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

DevelopmentKitのインストールが出来たようです。それでは、再度Rails4のインストールをしてみましょう。

> gem install rails4
・・・
25 gems installed

インストールできたようですので、確認します。

> rails -v
Rails 4.0.0

オッケーのようですね。