2011-04-05 237 views
0

我在OS X Snow Leopard上,我已經使用MySQL下載網站上的OS X軟件包安裝了MySQL,源代碼中的Ruby 1.8.7(which ruby僅產生usr/local/bin/ruby)和RubyGem 1.7.1 (從1.3.1使用gem update --system升級)也從源代碼(更新後gem我重新運行gem update)。啓動/停止MySQL服務器prefpane也已安裝。rails server命令失敗

這之後我已經安裝使用gem install rdocgem install mysqlgem install mysql2,在這個順序rdocmysqlmysql2寶石。

創建一個示例項目後,我修改了database.yml,以便mysql是使用的數據庫而不是sqlite3。

然後,我cd到項目文件夾,然後運行rails server,出現以下錯誤:

sample$ rails server /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): Library not loaded: libmysqlclient.18.dylib (LoadError)
Referenced from: /usr/local/lib/ruby/gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle Reason: image not found - /usr/local/lib/ruby/gems/1.8/gems/mysql2-0.2.7/lib/mysql2/mysql2.bundle from /usr/local/lib/ruby/gems/1.8/gems/mysql2-0.2.7/lib/mysql2.rb:8 from /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 require' from /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 require' from /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 require' from /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 require' from /usr/local/lib/ruby/gems/1.8/gems/railties-3.0.5/lib/rails/commands.rb:28 from /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 require' from script/rails:6

這有什麼錯我的配置? 我讀過有文件要重命名(?),但我不知道如何。 非常感謝大家 Riccardo

+0

http://www.blog.bridgeutopiaweb.com/post/how-to-fix-mysql-load-issues-on-mac-os-x/ – fl00r 2011-04-05 13:09:47

+0

http://stackoverflow.com/questions/4546698/圖書館不加載-的libmysqlclient-16 dylib-錯誤時,試圖對運行軌道發球 – fl00r 2011-04-05 13:10:18

回答

0

這看起來與this問題看起來很相似(如果不是相同的話)。在這個問題上有許多可能的解決方案。