1、在ruby官方上面提示在macbook中安装ruby可以执行这样一句话:% port install rubyy
2、但是要执行这个的前提是你已经安装了macport了,但是可恶的是你要安装macport的话要先安装mac上面的
xcode才能安装macport
3、所以你应该先下载xcode_3.2.4_and_ios_sdk_4.1.dmg然后安装之后,去http://www.macports.org/下载跟你mac系统一样的版本,我的机器mac版本是Snow Leopard 所以我下来了Snow Leopard 相关的版本MacPorts-1.9.2.pkg
4、接下来就可以安装ruby了
5、切换到root权限,然后执行 port install ruby
sh-3.2# port install ruby
---> 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
---> Applying patches to ncursesw
---> Configuring ncursesw
---> Building ncursesw
---> Staging ncursesw into destroot
---> Installing ncursesw @5.7_1
---> Activating ncursesw @5.7_1
---> Cleaning ncursesw
---> Fetching ncurses
---> Verifying checksum(s) for ncurses
---> Extracting ncurses
---> Applying patches to ncurses
---> Configuring ncurses
---> Building ncurses
---> Staging ncurses into destroot
---> Installing ncurses @5.7_1
---> Activating ncurses @5.7_1
---> 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.0b.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.0b_0
---> Activating openssl @1.0.0b_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
sh-3.2# port installed
The following ports are currently installed:
gperf @3.0.4_0 (active)
libiconv @1.13.1_0 (active)
ncurses @5.7_1 (active)
ncursesw @5.7_1 (active)
openssl @1.0.0b_0 (active)
readline @6.1.002_0 (active)
ruby @1.8.7-p302_0+thread_hooks (active)
zlib @1.2.5_0 (active)
sh-3.2# ruby -v
ruby 1.8.7 (2010-08-16 patchlevel 302) [i686-darwin10]