微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

mysql – 无法启动rails服务器

我已经安装了rails和mysql.我也安装了mysql2 gem.我通过命令创建了一个rails应用程序
 rails new try_cms -d MysqL
 它创建成功.但是当我尝试使用rails server命令运行WEBrick服务器时,我收到以下错误.

/Library/Ruby/Gems/1.8/gems/MysqL2-0.2.6/lib/MysqL2/MysqL2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/MysqL2-0.2.6/lib/MysqL2/MysqL2.bundle,9): Library not loaded: libMysqLclient.16.dylib (LoadError)
  Referenced from: /Library/Ruby/Gems/1.8/gems/MysqL2-0.2.6/lib/MysqL2/MysqL2.bundle
  Reason: image not found - /Library/Ruby/Gems/1.8/gems/MysqL2-0.2.6/lib/MysqL2/MysqL2.bundle
    from /Library/Ruby/Gems/1.8/gems/MysqL2-0.2.6/lib/MysqL2.rb:7
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.9/lib/bundler/runtime.rb:68:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.9/lib/bundler/runtime.rb:68:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.9/lib/bundler/runtime.rb:66:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.9/lib/bundler/runtime.rb:66:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.9/lib/bundler/runtime.rb:55:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.9/lib/bundler/runtime.rb:55:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.9/lib/bundler.rb:114:in `require'
    from /Users/dilippednekar/Sites/try_cms/config/application.rb:7
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28:in `require'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:28
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:27:in `tap'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.3/lib/rails/commands.rb:27
    from script/rails:6:in `require'
    from script/rails:6

提前致谢.

最佳答案
试试这个(见类似问题here)

sudo install_name_tool -change libMysqLclient.16.dylib /usr/local/MysqL/lib/libMysqLclient.16.dylib /Library/Ruby/Gems/1.8/gems/MysqL2-0.2.6/lib/MysqL2/MysqL2.bundle

原文地址:https://www.jb51.cc/mysql/433966.html

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐