MacPortsでrubyのインストール


MacPortsで最新のRubyをインストール

Snow Leopardの場合、最初からすでに ruby 1.8.7 (2009-06-12 patchlevel 174) が /usr/bin/ruby にインストールされているが、それより新しいヴァージョンが必要な場合(機能が足りない等の理由で)、 MacPortsを使って最新のRubyをインストール する。

/opt/local/bin/にインストールされる。

$ sudo port install ruby
Password: 
--->  Computing dependencies for ruby
--->  Dependencies to be installed: libiconv gperf ncurses ncursesw openssl zlib readline
--->  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.13.1.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.13.1_0
--->  Activating libiconv @1.13.1_0
--->  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 zlib
--->  Attempting to fetch zlib-1.2.5.tar.bz2 from http://distfiles.macports.org/zlib
--->  Verifying checksum(s) for zlib
--->  Extracting zlib
--->  Applying patches to zlib
--->  Configuring zlib
--->  Building zlib
--->  Staging zlib into destroot
--->  Installing zlib @1.2.5_0
--->  Activating zlib @1.2.5_0
--->  Cleaning zlib
--->  Fetching openssl
--->  Attempting to fetch openssl-1.0.0a.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 @1.0.0a_0
--->  Activating openssl @1.0.0a_0
--->  Cleaning openssl
--->  Fetching readline
--->  Attempting to fetch readline61-001 from ftp://ftp.dti.ad.jp/pub/GNU/readline/readline-6.1-patches/
--->  Attempting to fetch readline61-002 from ftp://ftp.dti.ad.jp/pub/GNU/readline/readline-6.1-patches/
--->  Attempting to fetch readline-6.1.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.1.002_0
--->  Activating readline @6.1.002_0
--->  Cleaning readline
--->  Fetching ruby
--->  Attempting to fetch ruby-1.8.7-p302.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-p302_0+thread_hooks
--->  Activating ruby @1.8.7-p302_0+thread_hooks
--->  Cleaning ruby

Rubyインストールの完了していることを確認

MacPorts から入れた Ruby は /opt/local/bin/ruby にあるはず。(csh系ではrehashしてからwhich)

$ which ruby
/opt/local/bin/ruby 
$ ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10]

return