我使用的是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。
在此之后,我按照此顺序使用rdoc
,mysql
和mysql2
安装了gem install rdoc
,gem install mysql
和gem 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:inrequire' 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:ineach' 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:ineach' 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:inrequire' 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:intap' 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