在Rails中启动WEBrick时遇到问题

时间:2011-06-20 03:19:08

标签: ruby-on-rails ruby rubygems

我需要一些帮助。尝试启动WEBrick时有什么问题?

所以我在终端输入“rails server”来启动WEBrick服务器,它会在下面发出响应。

感谢您的帮助!

david$ rails server
/Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError)
  Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
  Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2/mysql2.bundle
    from /Library/Ruby/Gems/1.8/gems/mysql2-0.2.11/lib/mysql2.rb:9
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:68:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:66:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:in `each'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler/runtime.rb:55:in `require'
    from /Library/Ruby/Gems/1.8/gems/bundler-1.0.15/lib/bundler.rb:120:in `require'
    from /Users/daviddiliberto/Sites/simple_cms/config/application.rb:7
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:28:in `require'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:28
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:27:in `tap'
    from /Library/Ruby/Gems/1.8/gems/railties-3.0.9/lib/rails/commands.rb:27
    from script/rails:6:in `require'
    from script/rails:6

4 个答案:

答案 0 :(得分:2)

你需要安装mysql2客户端和服务器,这是一个关于如何使用brew(我个人推荐的数据包管理器)的教程:

http://solutions.treypiepmeier.com/2010/02/28/installing-mysql-on-snow-leopard-using-homebrew/

答案 1 :(得分:0)

您需要安装mysql客户端及其库。

答案 2 :(得分:0)

在您的计算机上安装MySQL。你可以得到它here

之后,您需要:

gem 'mysql'

在你的Gemfile中。

答案 3 :(得分:0)

我遇到了完全相同的问题。问题是mysql,而不是mysql gem。我通过使用Homebrew重新安装mysql来解决它:

  1. 安装自制程序:http://mxcl.github.com/homebrew/
  2. 在终端中安装mysql:https://gist.github.com/trey/2722782

    $ brew install mysql