开发者

Problem launching WEBrick in Rails

I need some help here. Whats it's problem when trying to launch WEBrick?

So I type in "rails server" into terminal to launch the WEBrick server and it spits out the response below.

Thanks for all the help!

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


You need to install the mysql2 client and server, here's a tutorial on how to do it using brew, a packet manager I personally recommend:

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


Install MySQL on your machine. You can get it here.

After that, you need to have:

gem 'mysql'

In your Gemfile.


You need to install the mysql client and its libraries.


I had the exact same problem. The problem was mysql, not the mysql gem. I solved it by re-installing mysql using Homebrew:

  1. Install Homebrew: Link

  2. Install mysql in terminal: https://gist.github.com/trey/2722782

     $ brew install mysql
    
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜