Info

Snow Leopard デフォルト環境見てみる。

$ ruby -v
ruby 1.8.7 (2009-06-12 patchlevel 174) [universal-darwin10.0]
$ ls -l /usr/bin/ruby
lrwxr-xr-x  1 root  wheel  76  9  4  2009 /usr/bin/ruby -> ../../System/Library/Frameworks/Ruby.framework/Versions/Current/usr/bin/ruby

$ gem -v
1.3.5
$ ls -l /usr/bin/gem
lrwxr-xr-x  1 root  wheel  71  9  4  2009 /usr/bin/gem1.3.5 -> ../../System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/gem

$ rails -v
Rails 2.3.5
$ which rails
/usr/bin/rails

ruby, gem, rails順にバージョンアップして行く。

MacPortsでruby1.9をインストール

$ sudo port install ruby19
Password:
--->  Computing dependencies for ruby19
--->  Dependencies to be installed: libffi libiconv gperf libyaml ncurses ncursesw openssl zlib readline
--->  Fetching libffi
.......

$ sudo mv /usr/bin/ruby /usr/bin/ruby1.8.7
$ ln -s /opt/local/bin/ruby1.9 /usr/bin/ruby
$ ruby -v
ruby 1.9.2p136 (2010-12-25 revision 30365) [x86_64-darwin10]
$ 

最新版gemインストール
http://rubyforge.org/frs/?group_id=126 から rubygems-1.4.2.zipダウンロード。

$ ruby setup.rb 
/Users/dongrikim/Downloads/rubygems-1.4.2/lib/rubygems/source_index.rb:62:in `installed_spec_directories': undefined method `path' for Gem:Module (NoMethodError)
	from /Users/dongrikim/Downloads/rubygems-1.4.2/lib/rubygems/source_index.rb:52:in `from_installed_gems'
	from /Users/dongrikim/Downloads/rubygems-1.4.2/lib/rubygems.rb:914:in `source_index'
	from /Users/dongrikim/Downloads/rubygems-1.4.2/lib/rubygems/gem_path_searcher.rb:83:in `init_gemspecs'
	from /Users/dongrikim/Downloads/rubygems-1.4.2/lib/rubygems/gem_path_searcher.rb:13:in `initialize'
	from /Users/dongrikim/Downloads/rubygems-1.4.2/lib/rubygems.rb:873:in `new'
	from /Users/dongrikim/Downloads/rubygems-1.4.2/lib/rubygems.rb:873:in `searcher'
	from /Users/dongrikim/Downloads/rubygems-1.4.2/lib/rubygems.rb:495:in `find_files'
	from /Users/dongrikim/Downloads/rubygems-1.4.2/lib/rubygems.rb:1034:in `load_plugins'
	from /Users/dongrikim/Downloads/rubygems-1.4.2/lib/rubygems/gem_runner.rb:84:in `'
	from :29:in `require'
	from :29:in `require'
	from setup.rb:25:in `'
$

エラーで落ちた。ググッてみるとどうもruby1.9.2 からはgemがデフォルトで入ってるようでインストール必要なし。

$ gem1.9 -v
1.3.7
$ which gem1.9
/opt/local/bin/gem1.9
$ sudo mv /usr/bin/gem /usr/bin/gem1.3.5
$ sudo ln -s /opt/local/bin/gem1.9 /usr/bin/gem
$ gem -v
1.3.7
$

Railsのインストール

$ sudo gem install rails
$ sudo mv /usr/bin/rails /usr/bin/rails2.3.5
$ sudo ln -s /opt/local/bin/rails /usr/bin/rails
$ rails -v
Rails 3.0.3
$

これでRails3になった。

Comments

One Comment

Post a comment

Trackbacks & Pingbacks

  1. Mac OSX ( Lion ) に RubyOnRails3.1 環境構築 « foot mark

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

Basic HTML is allowed. Your email address will not be published.

Subscribe to this comment feed via RSS