0

Installed Rails 3.2.3 and MySQL 5.6 fine on my OSX 10.7.3

I created a new project called "simple_cms" and then, in the terminal, tried to launch webrick with "rails server" and got nothing.

Hideyoshis-MacBook-Pro:simple_CMS gregpfeffer$ rails s /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle: dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib (LoadError) Referenced from: /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle Reason: image not found - /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle from /Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2.rb:9 from /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:in require' from /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:68:inrequire' from /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:in each' from /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:66:inrequire' from /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:in each' from /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler/runtime.rb:55:inrequire' from /Library/Ruby/Gems/1.8/gems/bundler-1.1.3/lib/bundler.rb:119:in require' from /Users/gregpfeffer/Sites/simple_cms/config/application.rb:7 from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/commands.rb:53:inrequire' from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/commands.rb:53 from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/commands.rb:50:in tap' from /Library/Ruby/Gems/1.8/gems/railties-3.2.3/lib/rails/commands.rb:50 from script/rails:6:inrequire' from script/rails:6 Hideyoshis-MacBook-Pro:simple_CMS gregpfeffer$ sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/mysql/lib/libmysqlclient.16.dylib /Library/Ruby/Gems/1.8/gems/mysql2-0.2.4/lib/mysql2/mysql2.bundle install_name_tool: can't open file: /Library/Ruby/Gems/1.8/gems/mysql2-0.2.4/lib/mysql2/mysql2.bundle (No such file or directory)

4

1 回答 1

2

尝试添加:

export DYLD_LIBRARY_PATH=/usr/local/mysql/lib/:$DYLD_LIBRARY_PATH

到你的 .bash_profile

这假设您接受了 mysql 的默认安装位置

于 2012-05-07T03:27:19.133 回答