症状
Mac OS 10.7.3環境で、rvmを使ってruby 1.9.3を入れたところ、以下のエラーで、bundle install出来ませんでした。
Unfortunately, a fatal error has occurred. Please report this error to the Bundler issue tracker at https://github.com/carlhuda/bundler/issues so that we can fix it. Please include the full output of the command, your Gemfile and Gemfile.lock. Thanks!
/Users/annotunzdy/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire': dlopen(/Users/annotunzdy/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/digest/sha1.bundle, 9): Symbol not found: _rb_Digest_SHA1_Finish (LoadError)
require'
Referenced from: /Users/annotunzdy/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/digest/sha1.bundle
Expected in: flat namespace
in /Users/annotunzdy/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/digest/sha1.bundle - /Users/annotunzdy/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/digest/sha1.bundle
from /Users/annotunzdy/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/site_ruby/1.9.1/rubygems/custom_require.rb:36:in
from /Users/annotunzdy/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/definition.rb:1:in'
definition'
from /Users/annotunzdy/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler.rb:135:in
from /Users/annotunzdy/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/cli.rb:220:ininstall'
run'
from /Users/annotunzdy/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/vendor/thor/task.rb:22:in
from /Users/annotunzdy/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/vendor/thor/invocation.rb:118:ininvoke_task'
dispatch'
from /Users/annotunzdy/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/vendor/thor.rb:263:in
from /Users/annotunzdy/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/lib/bundler/vendor/thor/base.rb:386:instart'
'
from /Users/annotunzdy/.rvm/gems/ruby-1.9.3-p194@global/gems/bundler-1.1.3/bin/bundle:13:in
from /Users/annotunzdy/.rvm/gems/ruby-1.9.3-p194@global/bin/bundle:19:inload'
'
from /Users/annotunzdy/.rvm/gems/ruby-1.9.3-p194@global/bin/bundle:19:in
from /Users/annotunzdy/.rvm/gems/ruby-1.9.3-p194@global/bin/ruby_noexec_wrapper:14:ineval'
'
from /Users/annotunzdy/.rvm/gems/ruby-1.9.3-p194@global/bin/ruby_noexec_wrapper:14:in
原因
色々試したところ、Ruby 1.9.3のsha1.bundleのバグが原因であることがわかりました。
解決方法
そこで、以下のコマンドで、ruby 1.9.2のsha1.bundleを、1.9.3のディレクトリにコピーすることで解決しました。
mv "$HOME/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/digest/sha1.bundle" "$HOME/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/digest/sha1.bundle.bak"
cp "$HOME/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/x86_64-darwin11.3.0/digest/sha1.bundle" "$HOME/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/digest/sha1.bundle"
追記
sha1.bundle以外のbundleにも問題があることがわかりました。
以下のように、digestフォルダ丸ごとコピーしたほうがより安全です。
mv "$HOME/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/digest" "$HOME/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/digest.bak"
cp -R "$HOME/.rvm/rubies/ruby-1.9.2-p318/lib/ruby/1.9.1/x86_64-darwin11.3.0/digest" "$HOME/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/x86_64-darwin11.3.0/digest"