我在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 rdoc
,gem install mysql
和gem install mysql2
,在這個順序rdoc
,mysql
和mysql2
寶石。
創建一個示例項目後,我修改了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:inrequire' 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:ineach' 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:ineach' 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: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
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:intap' 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
http://www.blog.bridgeutopiaweb.com/post/how-to-fix-mysql-load-issues-on-mac-os-x/ – fl00r 2011-04-05 13:09:47
http://stackoverflow.com/questions/4546698/圖書館不加載-的libmysqlclient-16 dylib-錯誤時,試圖對運行軌道發球 – fl00r 2011-04-05 13:10:18