LoginSignup
9
9

More than 5 years have passed since last update.

Rubyのインストール::Windows

Last updated at Posted at 2015-08-10

対象

  • とりあえずRubyインストールして使ってみたい人

参考


ダウンロード

RubyInstaller for Windowsからインストーラをダウンロード

2015/08/10時点の一覧

  • Ruby 2.2.2
  • Ruby 2.2.2 (x64)
  • Ruby 2.1.6
  • Ruby 2.1.6 (x64)
  • Ruby 2.0.0-p645
  • Ruby 2.0.0-p645 (x64)
  • Ruby 1.9.3-p551

Windowsが64bitなのでとりあえずRuby 2.2.2 (x64)をダウンロード

インストール

  • 最低限Rubyの実行ファイルへ環境変数PATHを設定するのチェックは入れてからインストールを実行する
  • インストールする場所(パス)は任意だがC:\Ruby22-x64とかでいいと思う
  • インストール完了後、コマンドプロンプトでruby -vと実行してバージョン情報が表示されることを確認する
    • ruby 2.2.2p95 (2015-04-13 revision 50295) [x64-mingw32]とか表示されるはず

Development Kitのインストール

なにこれ?

コンパイルが必要なgemのインストールとかに必要
Ruby本体のみ使うならいらないけど、とりあえずいれとく

ダウンロード

今回Rubyは64bit版なので
DEVELOPMENT KITの部分の「For use with Ruby 2.0 and above (x64 - 64bits only)」とかいてある下記をダウンロード(2015/08/10時点)
DevKit-mingw64-64-4.7.2-20130224-1432-sfx.exe

インストール

インストール手順の詳細は下記参考先の記事どおり
WindowsにRubyをインストールする(初心者向け) - Qiita

なんだけどruby dk.rb installを実行したときとかにRubyが見つかれないっす的なエラーが出た場合はC:\RubyDevKit\config.ymlを開いて下記のように編集してください。
- C:\Ruby22-x64を追加してます)

# This configuration file contains the absolute path locations of all
# installed Rubies to be enhanced to work with the DevKit. This config
# file is generated by the 'ruby dk.rb init' step and may be modified
# before running the 'ruby dk.rb install' step. To include any installed
# Rubies that were not automagically discovered, simply add a line below
# the triple hyphens with the absolute path to the Ruby root directory.
#
# Example:
#
# ---
# - C:/ruby19trunk
# - C:/ruby192dev
#
- C:\Ruby22-x64
---

編集完了後、再度ruby dk.rb installを実行

インストール完了後にやっとくといいこと

gemのインストール

プロジェクト問わず使うことの多いbundlerとかpryとか、入れておく
というかbundlerはそもそも入れとかないとプロジェクトごとに分けらんないし
コマンドプロンプトで下記を実行してインストールする

gem install bundler
gem install pry
gem install pry-doc

で、このあとは?

irbでもpryでも使ってコンソール起動。pryのがおすすめ。
コンソール起動後に

Class.ancestors # => [Class, Module, Object, PP::ObjectMixin, Kernel, BasicObject]

とか

Class.new.class

とかして「クラスもClassクラスのインスタンスか。。。」とかつぶやくとそれっぽく見えるよ。

9
9
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
9
9