Rails server being aborted due to mysql lib file not available

Hi,

My system has the following :

MacOs Leopard
Rails 3
Ruby 1.9
Mysql 5.1.58
mysql2 ruby gems

My problem is that when i give “rails server”, the task aborts with
the foll error

rails server/Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/
railties-3.0.5/lib/rails/script_rails_loader.rb:11: warning: Insecure
world writable dir /usr/local/bin in PATH, mode 040777
/Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/bundler-1.0.11/lib/
bundler.rb:207: warning: Insecure world writable dir /usr/local/bin in
PATH, mode 040777
/Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/mysql2-0.2.6/lib/
mysql2.rb:7:in require': dlopen(/Users/nisha/.rvm/gems/ruby-1.9.2- p180@rails3/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/mysql/lib/libmysqlclient.15.dylib (LoadError) Referenced from: /Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/ mysql2-0.2.6/lib/mysql2/mysql2.bundle Reason: image not found - /Users/nisha/.rvm/gems/ruby-1.9.2- p180@rails3/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle from /Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/mysql2-0.2.6/ lib/mysql2.rb:7:in<top (required)>’
from /Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/
bundler-1.0.11/lib/bundler/runtime.rb:68:in require' from /Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/ bundler-1.0.11/lib/bundler/runtime.rb:68:inblock (2 levels) in
require’
from /Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/
bundler-1.0.11/lib/bundler/runtime.rb:66:in each' from /Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/ bundler-1.0.11/lib/bundler/runtime.rb:66:inblock in require’
from /Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/
bundler-1.0.11/lib/bundler/runtime.rb:55:in each' from /Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/ bundler-1.0.11/lib/bundler/runtime.rb:55:inrequire’
from /Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/
bundler-1.0.11/lib/bundler.rb:120:in require' from /Users/nisha/rails_app/da/config/application.rb:8:in<top
(required)>’
from /Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/
railties-3.0.5/lib/rails/commands.rb:28:in require' from /Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/ railties-3.0.5/lib/rails/commands.rb:28:inblock in <top (required)>’
from /Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/
railties-3.0.5/lib/rails/commands.rb:27:in tap' from /Users/nisha/.rvm/gems/ruby-1.9.2-p180@rails3/gems/ railties-3.0.5/lib/rails/commands.rb:27:in<top (required)>’
from script/rails:6:in require' from script/rails:6:in

i have tried googling, and most of the solutions suggest doing this :

sudo install_name_tool -change libmysqlclient.16.dylib /usr/local/
mysql/lib/libmysqlclient.16.dylib /users/nisha/.rvm/gems/ruby-1.9.2-
p180@rails3/gems/mysql2-0.2.6/lib/mysql2/mysql2.bundle

I have tried all the suggested methods, without any success.,
The .bash_profile file is updated to contain the DYLIB in the path.

The problem according to what i pecieve is : the rails3 has mysql2 gem
installed and this expects the libmysqlclient.15.dylib file whereas
the /usr/local/mysql/lib contains libmysqlclient16.dylib

due to this mismatch there is an error. how to get rid of this error ?
Pls help asap.

On Jul 18, 7:29pm, nisha [email protected] wrote:

I have tried all the suggested methods, without any success.,
The .bash_profile file is updated to contain the DYLIB in the path.

The problem according to what i pecieve is : the rails3 has mysql2 gem
installed and this expects the libmysqlclient.15.dylib file whereas
the /usr/local/mysql/lib contains libmysqlclient16.dylib

due to this mismatch there is an error. how to get rid of this error ?
Pls help asap.

Did you try reinstalling the mysql2 gem ?

Fred