One-Click Ruby Installerインストール後の手動Railsインストールでハマル(on Cygwin)

現象

教科書どおり、rubygemsのアーカイブを展開してsetup.rbを実行したら下記のように怒られました。

babydaemons@mypc /tmp
$ tar xvzpf rubygems-1.3.5.tgz
rubygems-1.3.5/
rubygems-1.3.5/.autotest
【中略】
rubygems-1.3.5/util/gem_prelude.rb.template

babydaemons@mypc /tmp
$ cd rubygems-1.3.5/

babydaemons@mypc /tmp/rubygems-1.3.5
$ ruby setup.rb
ruby: no such file to load -- ubygems (LoadError)

原因


One-Click Ruby Installerが環境変数RUBYOPTに"-rubygems"を設定しているの原因だそうです。

とりあえずの逃げ

babydaemons@mypc /tmp/rubygems-1.3.5
$ RUBYOPT=; export RUBYOPT

babydaemons@mypc /tmp/rubygems-1.3.5
$ ruby setup.rb
RubyGems 1.3.5 installed
【中略】
RubyGems installed the following executables:
        /usr/bin/gem

抜本対策

vi /etc/profileして下記を追記しておきましょうw

# see, http://d.hatena.ne.jp/daftbeats/20070531/1180613965
# see, http://d.hatena.ne.jp/argius/20071013/1192297580
RUBYOPT=
export RUBYOPT

仕上げに

railsをインストール。

babydaemons@mypc /tmp/rubygems-1.3.5
$ gem install rails --include-dependencies
INFO:  `gem install -y` is now default and will be removed
INFO:  use --ignore-dependencies to install only the gems you list
Successfully installed activeresource-2.3.3
Successfully installed rails-2.3.3
2 gems installed
Installing ri documentation for activeresource-2.3.3...
Installing ri documentation for rails-2.3.3...
Installing RDoc documentation for activeresource-2.3.3...
Installing RDoc documentation for rails-2.3.3...