这是我得到的错误:
$ rails s
/Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle: dlsym(0x13782a0, Init_mysql2): symbol not found - /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle (LoadError)
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/mysql2-0.2.7/lib/mysql2.rb:8
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:68:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `each'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:66:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `each'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler/runtime.rb:55:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/bundler-1.0.13/lib/bundler.rb:120:in `require'
from /Users/nicolas/git/hits/config/application.rb:7
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.6/lib/rails/commands.rb:28:in `require'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.6/lib/rails/commands.rb:28
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.6/lib/rails/commands.rb:27:in `tap'
from /Users/nicolas/.rvm/gems/ruby-1.9.2-p180/gems/railties-3.0.6/lib/rails/commands.rb:27
from script/rails:6:in `require'
from script/rails:6
这是一个非常持久的错误。以下是一些可能有助于解决问题的信息:
以下是有关我的系统的更多信息:
$ echo $DYLD_LIBRARY_PATH
/usr/local/mysql/lib:
$ file ~/.rvm/rubies/default/bin/ruby
/Users/nicolas/.rvm/rubies/default/bin/ruby: Mach-O 64-bit executable x86_64
$ file /usr/local/mysql/lib/libmysqlclient.18.dylib
/usr/local/mysql/lib/libmysqlclient.18.dylib: Mach-O 64-bit dynamically linked shared library x86_64
$ rvm list
rvm rubies
=> ruby-1.9.2-p180 [ x86_64 ]
$ which ruby
/opt/local/bin/ruby
$ file /opt/local/bin/ruby
/opt/local/bin/ruby: Mach-O executable i386
答案 0 :(得分:1)
which ruby
表示您使用的不是RVM提供的ruby。安装RVM和ruby之后,你必须告诉RVM使用它:
rvm use --default 1.9.2
如果你还没有在RVM上安装ruby,那么你必须在使用之前安装它:
rvm install 1.9.2
之后你可能需要再次安装rails,因为你当前的版本可能安装了系统ruby而不是RVM。