3

Possible Duplicate:
Library not loaded: libmysqlclient.16.dylib error when trying to run 'rails server' on OS X 10.6 with mysql2 gem

Why i get this error?? What's means?

i have installed mysql2 gem, "sudo gem install mysql2"

Gemfile:

gem 'mysql2'

~: rake db:migrate --trace

rake aborted!
dlopen(/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9): Library not loaded: libmysqlclient.18.dylib
  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
/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
/Library/Ruby/Gems/1.8/gems/mysql2-0.3.11/lib/mysql2.rb:9
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `require'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
/Library/Ruby/Gems/1.8/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
/Users/leonardo/dev/myproject/config/application.rb:7
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `gem_original_require'
/Library/Ruby/Site/1.8/rubygems/custom_require.rb:36:in `require'
/Users/leonardo/dev/myproject/Rakefile:5
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/rake_module.rb:25:in `load_rakefile'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:501:in `raw_load_rakefile'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:82:in `load_rakefile'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:81:in `load_rakefile'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:65:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:133:in `standard_exception_handling'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/lib/rake/application.rb:63:in `run'
/Library/Ruby/Gems/1.8/gems/rake-0.9.2.2/bin/rake:33
/usr/bin/rake:19:in `load'
/usr/bin/rake:19
Community
  • 1
  • 1
sparkle
  • 7,530
  • 22
  • 69
  • 131
  • 2
    RESOLVED: http://stackoverflow.com/a/6100648/1028100 Thanks you! Now you can close this question – sparkle Dec 08 '11 at 21:12

1 Answers1

3

Put this bit of code in your .profile and .bash_profile files. If you don't know how to do that, type this in the terminal every time you open it...

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

This is what my .bash_profile looks like:

alias ll="ls -lahG"  
alias whereami="pwd"

export PATH="/Applications/MAMP/bin:/usr/local/bin:/usr/local/sbin:usr/local/my$
export DYLD_LIBRARY_PATH="/usr/local/mysql/lib:$DYLD_LIBRARY_PATH"

To edit your bash, in the root ($) terminal menu, type in ls -la, then type in nano .bash_profile and/or nano .profile to get into the text editor for the bash (I just keep them both the same, it might be redundant I don't know).

Once you're done with editing, hit ctrl-X, then 'return' to get back to the main menu, so to speak.

Bo Persson
  • 90,663
  • 31
  • 146
  • 203
boulder_ruby
  • 38,457
  • 9
  • 79
  • 100
  • OR just change your config/database.yml file to work with sqlite3. If you don't need to be using mysql, you shouldn't be using mysql. sqlite3 is perfectly fine and you can always jump to mysql whenever you feel like it. Just google for a database.yml file for sqlite3, there's bound to be plenty on github.com – boulder_ruby Aug 18 '12 at 00:37