rails server命令失败

时间:2011-04-05 10:24:08

标签: mysql ruby-on-rails ruby osx-snow-leopard gem

我使用的是OS X Snow Leopard,我使用MySQL下载网站上的OS X软件包安装了MySQL,源代码为Ruby 1.8.7(which ruby仅产生usr/local/bin/ruby) RubyGem 1.7.1(使用gem update --system从1.3.1升级)也来自源代码(在更新gem之后我重新运行gem update)。也安装了启动/停止MySQL服务器prefpane。

在此之后,我按照此顺序使用rdocmysqlmysql2安装了gem install rdocgem install mysqlgem install mysql2宝石。

创建示例项目后,我修改了database.yml,以便mysql是使用的db而不是sqlite3。

然后,我cd进入项目文件夹并运行rails server并出现以下错误:

  

示例$ rails服务器   /usr/local/lib/ruby/gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle:   dlopen的(/usr/local/lib/ruby/gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle,   9):未加载库:libmysqlclient.18.dylib(LoadError)
  参考自:   /usr/local/lib/ruby/gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle   原因:图片未找到 -   /usr/local/lib/ruby/gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle     来自/usr/local/lib/ruby/gems/1.8/gems/mysql2-0.2.7/lib/mysql2.rb:8     从   /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.11/lib/bundler/runtime.rb:68:in   require' from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.11/lib/bundler/runtime.rb:68:in 需要'来自   /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.11/lib/bundler/runtime.rb:66:in   each' from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.11/lib/bundler/runtime.rb:66:in 需要'来自   /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.11/lib/bundler/runtime.rb:55:in   each' from /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.11/lib/bundler/runtime.rb:55:in 需要'来自   /usr/local/lib/ruby/gems/1.8/gems/bundler-1.0.11/lib/bundler.rb:120:in   require' from /Users/riccardo/Workspace/restaurant/config/application.rb:7 from /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:28:in 需要'来自   /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:28     从   /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:27:in   tap' from /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:27 from script/rails:6:in需要'来自script / rails:6

我的配置有什么问题? 我读到有文件要重命名(?)但我不明白怎么做。 非常感谢大家 的Riccardo

1 个答案:

答案 0 :(得分:0)

这与this问题类似(如果不相同)。关于这个问题,有许多可能的解决方案。