无法启动 rails 服务器



我知道这些问题之前已经回答了,但我不能启动我已经设置的rails服务器。有人在这里发布了完全相同的错误无法启动rails服务器,但我不能让它与答案一起工作。我对这一切都是新手,所以如果能得到帮助,我将非常感激。

/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

Im运行:mySQL: 5.5.11

rails: 3.0.7

ruby 1.8.7:

宝石:1.7.2

mySQL2: 0.2.7

有人能帮忙吗?谢谢!

其他两个链接都没有和你的相同的问题,这两个问题都是旧的mysql2宝石,没有完整的路径到libmysqlclient.16.dylib在包中,请注意,你的错误有完整的路径,Library not loaded: /usr/local/mysql/lib/libmysqlclient.16.dylib(其他问题没有)。

你的问题是这个库可能不存在,因为在大多数OSX系统中MySQL不会安装在那里。

假设您已经安装了MySQL,您应该有一个名为mysql_config的命令-您希望通过将安装程序指向该文件来安装gem。然后,安装的程序可以使用mysql_config的输出来找到它需要的所有MySQL库的正确位置。

无聊,只想知道答案?

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

相关内容

  • 没有找到相关文章