FrontPage
Ruby on Railsのインストールは、以下の手順で行う。
私は、主にMac OSXとWindows 2000を使っているので、これらの機種へのインストール 手順を書き留める。
Mac OSX 10.4からrubyがデフォルトでインストールされている。 rubyがインストールされているかどうかの確認は、ターミナルでruby -v と入力することで 分かる。
$ ruby -v ruby 1.8.2 (2004-12-25) [universal-darwin8.0] }}
webサイト にアクセスしたのだが、うまく接続できない。 そこで、 にアクセスし、RubyGemsをダウンロードする。 ダウンロードしたRubyGemsのバージョンは、REL_0_9_0だった。
展開する場所は、ホームディレクトリ/local/にした。
RubyGemsのインストールは、展開した場所に移動し、ruby setup.rbと入力する。 このとき、スーパーユーザーの権限が必要なので、Mac OSXではsuが使えないので 以下のようにsudoで代用した。
$ cd ~/local/rubygems-0.9.0 $ sudo ruby setup.rb Password:
--- bin
--- lib/rbconfig
--- lib/rubygems
--- lib
--- bin
--- lib/rbconfig
--- lib/rubygems
--- lib rm -f InstalledFiles
--- bin
--- lib/rbconfig
--- lib/rubygems
--- lib
As of RubyGems 0.8.0, library stubs are no longer needed. Searching $LOAD_PATH for stubs to optionally delete (may take a while)... ...done. No library stubs found.
}}
Mac OSXのrubyに不具合があるため、以下の処理が必要である。
$ sudo gem install fixrbconfig Bulk updating Gem source index for: Successfully installed fixrbconfig-1.2 $ sudo fixrbconfig ==================== /usr/lib/ruby/1.8/powerpc-darwin8.0/ruby.h does not exist. This probably means you haven't yet installed Xcode from the Tiger DVD. You won't be able to compile Ruby extensions without it. Please install it then rerun this program. }} おそらく、intel-macなのにpowerpcのヘッダを見に行っているのでエラーになったらしい。 そこで、/usr/lib/ruby/1.8/universal-darwin8.0をpowerpc-darwinにシンボリックリンクを張ることにした
$ cd /usr/lib/ruby/1.8 $ sudo ln -s universal-darwin8.0 powerpc-darwin8.0 }} 再度、
$ sudo fixrbconfig ==================== This program will replace your rbconfig.rb , located in /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb Press enter continue or ctrl-c to abort.
Backing up original rbconfig.rb in /usr/lib/ruby/1.8/powerpc-darwin8.0/rbconfig.rb.bak
All Done! You should be able to compile C extensions now!
}}
最後にRuby on Railsをインストールする、RubyGemsを使うとgem install railsのコマンド1つで インストールが完了する。
$ sudo gem install rails --include-dependencies --version 1.1.2 Password: Successfully installed rails-1.1.2 Successfully installed rake-0.7.1 Successfully installed activesupport-1.3.1 Successfully installed activerecord-1.14.2 Successfully installed actionpack-1.12.1 Successfully installed actionmailer-1.2.1 Successfully installed actionwebservice-1.1.2 Installing ri documentation for rake-0.7.1... Installing ri documentation for activesupport-1.3.1... Installing ri documentation for activerecord-1.14.2... Installing ri documentation for actionpack-1.12.1... Installing ri documentation for actionmailer-1.2.1... Installing ri documentation for actionwebservice-1.1.2... Installing RDoc documentation for rake-0.7.1... Installing RDoc documentation for activesupport-1.3.1... Installing RDoc documentation for activerecord-1.14.2... Installing RDoc documentation for actionpack-1.12.1... Installing RDoc documentation for actionmailer-1.2.1... Installing RDoc documentation for actionwebservice-1.1.2... }}
railsの動作確認は、
$ rails -v Rails 1.1.2 }} バージョン1.1.2が表示されればOKである。
Mac OSX用のPkgインストーラが以下のサイトにある。 ここから、
データベースアダプタには、Ruby版とC版がある。 Ruby版のインストールは、以下のように行う。
$ sudo gem install postgres-pr Bulk updating Gem source index for: Successfully installed postgres-pr-0.4.0 }}
C版のインストールは、以下のように行う。
$ sudo gem install ruby-postgres Bulk updating Gem source index for: Select which gem to install for your platform (universal-darwin8.0)
1 Building native extensions. This could take a while... extconf.rb:6: command not found: pg_config --includedir extconf.rb:13: command not found: pg_config --libdir
ERROR: While executing gem ... (RuntimeError)
Gem files will remain installed in /usr/lib/ruby/gems/1.8/gems/ruby-postgres-0.7.1.2006.04.06 for inspection.
Results logged to /usr/lib/ruby/gems/1.8/gems/ruby-postgres-0.7.1.2006.04.06/gem_make.out
}} PostgreSQLをパッケージを使ったため、pg_configが存在しなかったので失敗したようだ。 取りあえず、ruby版を使うことにする。
皆様のご意見、ご希望をお待ちしております。