やりたいこととまんま同じことが書いてあるサイトがあったのでこちらを参考にセットアップする.
Mac OS X 10.6 に Ruby 1.9.2 をインストール - yoshioblog
手順
- portコマンドの設定
- readlineインストール(文字化け対策)
- rvmインストール(Ruby Version Manager)
- Ruby1.9インストール
portコマンドの設定
$ sudo port selfupdate Warning: port definitions are more than two weeks old, consider using selfupdate ---> Updating the ports tree ---> Updating MacPorts base sources using rsync MacPorts base version 1.9.2 installed, MacPorts base version 2.0.3 downloaded. ---> MacPorts base is outdated, installing new version 2.0.3 Installing new MacPorts release in /opt/local as root:admin; permissions 0755; Tcl-Package in /Library/Tcl The ports tree has been updated. To upgrade your installed ports, you should run port upgrade outdated
readlineインストール
$ sudo port install readline ---> Fetching archive for ncursesw ---> Attempting to fetch ncursesw-5.8_0.darwin_10.noarch.tbz2 from http://packages.macports.org/ncursesw ---> Attempting to fetch ncursesw-5.8_0.darwin_10.noarch.tbz2.rmd160 from http://packages.macports.org/ncursesw ---> Installing ncursesw @5.8_0 ---> Cleaning ncursesw ---> Deactivating ncursesw @5.7_1 ---> Cleaning ncursesw ---> Activating ncursesw @5.8_0 ---> Cleaning ncursesw ---> Computing dependencies for ncurses ---> Fetching archive for ncurses ---> Attempting to fetch ncurses-5.9_1.darwin_10.x86_64.tbz2 from http://packages.macports.org/ncurses ---> Attempting to fetch ncurses-5.9_1.darwin_10.x86_64.tbz2.rmd160 from http://packages.macports.org/ncurses ---> Installing ncurses @5.9_1 ---> Cleaning ncurses ---> Deactivating ncurses @5.7_1 ---> Cleaning ncurses ---> Activating ncurses @5.9_1 ---> Cleaning ncurses ---> Computing dependencies for readline ---> Fetching archive for readline ---> Attempting to fetch readline-6.2.000_0.darwin_10.x86_64.tbz2 from http://packages.macports.org/readline ---> Attempting to fetch readline-6.2.000_0.darwin_10.x86_64.tbz2.rmd160 from http://packages.macports.org/readline ---> Installing readline @6.2.000_0 ---> Activating readline @6.2.000_0 ---> Cleaning readline
$ cd rvm $ ./install Installing RVM to /Users/username/.rvm/ Adding rvm loading line to '/Users/username/.bash_profile'. # RVM: Shell scripts enabling management of multiple ruby environments. # RTFM: https://rvm.beginrescueend.com/ # HELP: http://webchat.freenode.net/?channels=rvm (#rvm on irc.freenode.net) # Screencast: http://screencasts.org/episodes/how-to-use-rvm # In case of any issues read output of 'rvm requirements' and/or 'rvm notes' Installation of RVM in /Users/username/.rvm/ is almost complete: * To start using RVM you need to run `source /Users/username/.bash_profile` in all your open shell windows, in rare cases you need to reopen all shell windows. * Optionally you can run `rvm tools rvm-env ruby bash` which will generate shebang wrappers for easier selecting ruby in scripts. # username, # # Thank you for using RVM! # I sincerely hope that RVM helps to make your life easier and more enjoyable!!! # # ~Wayne
rvmインストール
$ git clone --depth 1 git://github.com/wayneeseguin/rvm.git Cloning into rvm... remote: Counting objects: 5618, done. remote: Compressing objects: 100% (2873/2873), done. remote: Total 5618 (delta 3760), reused 3755 (delta 2106) Receiving objects: 100% (5618/5618), 1.89 MiB | 656 KiB/s, done. Resolving deltas: 100% (3760/3760), done.
ruby1.9.3インストール
$ rvm install 1.9.3 Fetching yaml-0.1.4.tar.gz to /Users/username/.rvm/archives % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 460k 100 460k 0 0 114k 0 0:00:04 0:00:04 --:--:-- 371k Extracting yaml-0.1.4.tar.gz to /Users/username/.rvm/src Configuring yaml in /Users/username/.rvm/src/yaml-0.1.4. Compiling yaml in /Users/username/.rvm/src/yaml-0.1.4. Installing yaml to /Users/username/.rvm/usr Installing Ruby from source to: /Users/username/.rvm/rubies/ruby-1.9.3-p0, this may take a while depending on your cpu(s)... ruby-1.9.3-p0 - #fetching ruby-1.9.3-p0 - #downloading ruby-1.9.3-p0, this may take a while depending on your connection... % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 9330k 100 9330k 0 0 2952k 0 0:00:03 0:00:03 --:--:-- 3043k ruby-1.9.3-p0 - #extracting ruby-1.9.3-p0 to /Users/username/.rvm/src/ruby-1.9.3-p0 ruby-1.9.3-p0 - #extracted to /Users/username/.rvm/src/ruby-1.9.3-p0 ruby-1.9.3-p0 - #configuring ruby-1.9.3-p0 - #compiling ruby-1.9.3-p0 - #installing Retrieving rubygems-1.8.15 % Total % Received % Xferd Average Speed Time Time Time Current Dload Upload Total Spent Left Speed 100 245k 100 245k 0 0 39631 0 0:00:06 0:00:06 --:--:-- 1887k Extracting rubygems-1.8.15 ... Removing old Rubygems files... Installing rubygems-1.8.15 for ruby-1.9.3-p0 ... Installation of rubygems completed successfully. ruby-1.9.3-p0 - adjusting #shebangs for (gem irb erb ri rdoc testrb rake). ruby-1.9.3-p0 - #importing default gemsets (/Users/username/.rvm/gemsets/) Install of ruby-1.9.3-p0 - #complete
インストールしたruby1.9.3をアクティブにする
$ rvm 1.9.3
バージョン確認
$ ruby -v ruby 1.9.3p0 (2011-10-30 revision 33570) [x86_64-darwin10.8.0]
参考にしたサイト
rvm: 複数のRubyを共存させる最新のやり方 - 床のトルストイ、ゲイとするとのこと
http://d.hatena.ne.jp/mirakui/20100502/1272849327