无法启动rails服务器

时间:2011-04-22 02:08:42

标签: ruby-on-rails-3 macos osx-snow-leopard

我知道这些问题之前已经得到解答但是我无法启动我已经设置的rails服务器。有人在Unable to start rails server发布了完全相同的错误,但我无法使用它来解决问题。我真的很新,所以非常感谢你的帮助。

/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib (LoadError)
  Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle
  Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle
    from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.7/lib/mysql2.rb:8
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:68:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:66:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler/runtime.rb:55:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.12/lib/bundler.rb:120:in `require'
    from /Users/valentin/Sites/simple_cms/config/application.rb:7
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28:in `require'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:28
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27:in `tap'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.7/lib/rails/commands.rb:27
    from script/rails:6:in `require'
    from script/rails:6

我跑步: mySQL:5.5.11

rails:3.0.7

红宝石:1.8.7

宝石:1.7.2

mySQL2:0.2.7

有人可以帮忙吗?谢谢!

1 个答案:

答案 0 :(得分:1)

其他任何一个链接都没有与您的问题相同,这两个问题都出现在旧版mysql2宝石中,但是没有完整路径libmysqlclient.16.dylib,请注意您的错误完整路径Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib(其他问题没有)。

你的问题是lib可能不存在,因为那不是MySQL将在大多数OSX系统中安装的地方。

假设你已经安装了MySQL,你应该有一个名为mysql_config的命令 - 你想通过将安装程序指向这个文件来安装你的gem。然后,安装人员可以使用mysql_config的输出为所需的所有MySQL库找到合适的位置。

无聊,只想要答案?

sudo gem install mysql2 -- --with-mysql-config=`which mysql_config`