MacBook-Leopard環境でのRails2.3.2環境構築

自宅のMacbookがおかしくなってきたので、再インストールしました。

その際の環境構築手順のメモ書き。
今回は、全てMacPortsを使って構築してみようと思います。
参考サイトは、下記の通り。
http://japan.cnet.com/blog/kenn/2007/12/19/entry_25003169/
http://d.hatena.ne.jp/june29/20071119/1195432600
http://japan.cnet.com/blog/kenn/2007/12/19/entry_25003169/

0)バージョン確認

monote$ rails -v
Rails 1.2.6
monote$ ruby -v
ruby 1.8.6 (2008-03-03 patchlevel 114) [universal-darwin9.0]
monote$ gem -v
1.0.1

1)インストールディスクより、XcoodeToolsとX11SDK.dmgをインストール。

2)Macportsをダウンロード&インストール
http://svn.macosforge.org/repository/macports/downloads/

http://svn.macosforge.org/repository/macports/downloads/MacPorts-1.7.1/MacPorts-1.7.1-10.5-Leopard.dmg

インストール完了

monote$ port -v
MacPorts 1.710

3)macportsのアップデート確認

monote$ sudo port -v selfupdate

WARNING: Improper use of the sudo command could lead to data loss
or the deletion of important system files. Please double-check your
typing when using sudo. Type "man sudo" for more information.

To proceed, enter your password, or type Ctrl-C to abort.

Password:
Synchronizing local ports tree from rsync://rsync.macports.org/release/ports/
receiving file list ... done

sent 36 bytes  received 376481 bytes  83670.44 bytes/sec
total size is 23003906  speedup is 61.10
receiving file list ... done

sent 36 bytes  received 6953 bytes  2795.60 bytes/sec
total size is 4061730  speedup is 581.16

MacPorts base version 1.710 installed
Downloaded MacPorts base version 1.710

The MacPorts installation is not outdated so it was not updated

4)ruby-gemsのインストール

monote$ sudo port install rb-rubygems
--->  Fetching expat
--->  Attempting to fetch expat-2.0.1.tar.gz from http://internap.dl.sourceforge.net/expat
--->  Verifying checksum(s) for expat
--->  Extracting expat
--->  Configuring expat
--->  Building expat
--->  Staging expat into destroot
--->  Installing expat @2.0.1_0
--->  Activating expat @2.0.1_0
--->  Cleaning expat
--->  Fetching gperf
--->  Attempting to fetch gperf-3.0.4.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/gperf
--->  Verifying checksum(s) for gperf
--->  Extracting gperf
--->  Configuring gperf
--->  Building gperf
--->  Staging gperf into destroot
--->  Installing gperf @3.0.4_0
--->  Activating gperf @3.0.4_0
--->  Cleaning gperf
--->  Fetching libiconv
--->  Attempting to fetch libiconv-1.12.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/libiconv
--->  Verifying checksum(s) for libiconv
--->  Extracting libiconv
--->  Applying patches to libiconv
--->  Configuring libiconv
--->  Building libiconv
--->  Staging libiconv into destroot
--->  Installing libiconv @1.12_2
--->  Activating libiconv @1.12_2
--->  Cleaning libiconv
--->  Fetching ncursesw
--->  Attempting to fetch ncurses-5.7.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/ncurses
--->  Verifying checksum(s) for ncursesw
--->  Extracting ncursesw
--->  Configuring ncursesw
--->  Building ncursesw
--->  Staging ncursesw into destroot
--->  Installing ncursesw @5.7_0
--->  Activating ncursesw @5.7_0
--->  Cleaning ncursesw
--->  Fetching ncurses
--->  Verifying checksum(s) for ncurses
--->  Extracting ncurses
--->  Configuring ncurses
--->  Building ncurses
--->  Staging ncurses into destroot
--->  Installing ncurses @5.7_0
--->  Activating ncurses @5.7_0
--->  Cleaning ncurses
--->  Fetching gettext
--->  Attempting to fetch gettext-0.17.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/gettext
--->  Verifying checksum(s) for gettext
--->  Extracting gettext
--->  Applying patches to gettext
--->  Configuring gettext
--->  Building gettext
--->  Staging gettext into destroot
--->  Installing gettext @0.17_4
--->  Activating gettext @0.17_4
--->  Cleaning gettext
--->  Fetching perl5.8
--->  Attempting to fetch perl-5.8.9.tar.bz2 from http://distfiles.macports.org/perl5.8
--->  Verifying checksum(s) for perl5.8
--->  Extracting perl5.8
--->  Applying patches to perl5.8
--->  Configuring perl5.8
--->  Building perl5.8
--->  Staging perl5.8 into destroot
--->  Installing perl5.8 @5.8.9_3
--->  Activating perl5.8 @5.8.9_3
--->  Cleaning perl5.8
--->  Fetching perl5
--->  Verifying checksum(s) for perl5
--->  Extracting perl5
--->  Configuring perl5
--->  Building perl5
--->  Staging perl5 into destroot
--->  Installing perl5 @5.8.9_0
--->  Activating perl5 @5.8.9_0
--->  Cleaning perl5
--->  Fetching p5-locale-gettext
--->  Attempting to fetch gettext-1.05.tar.gz from ftp://ftp.cpan.org/pub/CPAN/modules/by-module/Locale
--->  Verifying checksum(s) for p5-locale-gettext
--->  Extracting p5-locale-gettext
--->  Applying patches to p5-locale-gettext
--->  Configuring p5-locale-gettext
--->  Building p5-locale-gettext
--->  Staging p5-locale-gettext into destroot
--->  Installing p5-locale-gettext @1.05_0
--->  Activating p5-locale-gettext @1.05_0
--->  Cleaning p5-locale-gettext
--->  Fetching help2man
--->  Attempting to fetch help2man-1.36.4.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/help2man
--->  Verifying checksum(s) for help2man
--->  Extracting help2man
--->  Applying patches to help2man
--->  Configuring help2man
--->  Building help2man
--->  Staging help2man into destroot
--->  Installing help2man @1.36.4_1
--->  Activating help2man @1.36.4_1
--->  Cleaning help2man
--->  Fetching m4
--->  Attempting to fetch m4-1.4.12.tar.bz2 from ftp://ftp.dti.ad.jp/pub/GNU/m4
--->  Verifying checksum(s) for m4
--->  Extracting m4
--->  Applying patches to m4
--->  Configuring m4
--->  Building m4
--->  Staging m4 into destroot
--->  Installing m4 @1.4.12_1
--->  Activating m4 @1.4.12_1
--->  Cleaning m4
--->  Fetching autoconf
--->  Attempting to fetch autoconf-2.63.tar.bz2 from ftp://ftp.dti.ad.jp/pub/GNU/autoconf
--->  Verifying checksum(s) for autoconf
--->  Extracting autoconf
--->  Configuring autoconf
--->  Building autoconf
--->  Staging autoconf into destroot
--->  Installing autoconf @2.63_0
--->  Activating autoconf @2.63_0
--->  Cleaning autoconf
--->  Fetching zlib
--->  Attempting to fetch zlib-1.2.3.tar.bz2 from http://nchc.dl.sourceforge.net/libpng
--->  Verifying checksum(s) for zlib
--->  Extracting zlib
--->  Applying patches to zlib
--->  Configuring zlib
--->  Building zlib
--->  Staging zlib into destroot
--->  Installing zlib @1.2.3_2
--->  Activating zlib @1.2.3_2
--->  Cleaning zlib
--->  Fetching openssl
--->  Attempting to fetch openssl-0.9.8k.tar.gz from http://distfiles.macports.org/openssl
--->  Verifying checksum(s) for openssl
--->  Extracting openssl
--->  Applying patches to openssl
--->  Configuring openssl
--->  Building openssl
--->  Staging openssl into destroot
--->  Installing openssl @0.9.8k_0
--->  Activating openssl @0.9.8k_0
--->  Cleaning openssl
--->  Fetching readline
--->  Attempting to fetch readline-6.0.tar.gz from ftp://ftp.dti.ad.jp/pub/GNU/readline
--->  Verifying checksum(s) for readline
--->  Extracting readline
--->  Applying patches to readline
--->  Configuring readline
--->  Building readline
--->  Staging readline into destroot
--->  Installing readline @6.0.000_1
--->  Activating readline @6.0.000_1
--->  Cleaning readline
--->  Fetching ruby
--->  Attempting to fetch ruby-1.8.7-p72.tar.bz2 from ftp://ftp.iij.ad.jp/pub/lang/ruby/1.8
--->  Verifying checksum(s) for ruby
--->  Extracting ruby
--->  Applying patches to ruby
--->  Configuring ruby
--->  Building ruby
--->  Staging ruby into destroot
--->  Installing ruby @1.8.7-p72_3+thread_hooks
--->  Activating ruby @1.8.7-p72_3+thread_hooks
--->  Cleaning ruby
--->  Fetching rb-rubygems
--->  Attempting to fetch rubygems-1.3.1.tgz from http://distfiles.macports.org/ruby
--->  Verifying checksum(s) for rb-rubygems
--->  Extracting rb-rubygems
--->  Applying patches to rb-rubygems
--->  Configuring rb-rubygems
--->  Building rb-rubygems
--->  Staging rb-rubygems into destroot
--->  Installing rb-rubygems @1.3.1_0
--->  Activating rb-rubygems @1.3.1_0
--->  Cleaning rb-rubygems

5)インストール確認

$ port installed
The following ports are currently installed:
  autoconf @2.63_0 (active)
  expat @2.0.1_0 (active)
  gettext @0.17_4 (active)
  gperf @3.0.4_0 (active)
  help2man @1.36.4_1 (active)
  libiconv @1.12_2 (active)
  m4 @1.4.12_1 (active)
  ncurses @5.7_0 (active)
  ncursesw @5.7_0 (active)
  openssl @0.9.8k_0 (active)
  p5-locale-gettext @1.05_0 (active)
  perl5 @5.8.9_0 (active)
  perl5.8 @5.8.9_3 (active)
  rb-rubygems @1.3.1_0 (active)
  readline @6.0.000_1 (active)
  ruby @1.8.7-p72_3+thread_hooks (active)
  zlib @1.2.3_2 (active)


追記:定期メンテナンス
$ sudo port -d selfupdate ... MacPorts本体とカタログを更新します
$ sudo port upgrade installed ... MacPortsでインストールされているパッケージを全て最新版にします
$ sudo gem update --system ... RubyGems本体を更新します
$ sudo gem update ... RubyGemsでインストールされているRuby関連パッケージを全て最新版にします

■gemsのupdate
rb-gemsのままだと1.2.6と1.2系のままとなるので、下記のように2.x系にupdateできるようにする。
最新バージョンを確認する。
http://wiki.rubyonrails.org/
http://rubyonrails.org/

$gem install rails -v=2.3.3