CodeGeek123
CodeGeek123

Reputation: 4501

Use Mysql2 for Ruby

I try to run rails S and get the following error.

 /Users/ME/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.8/lib/mysql2.rb:9:in `require':     dlopen(/Users/KaushiK/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.8/lib/mysql2/mysql2.bundle, 9): Library not loaded: /usr/local/mysql-5.5.10-osx10.6-x86_64/lib/libmysqlclient.18.dylib (LoadError)
Referenced from: /Users/ME/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.8/lib/mysql2/mysql2.bundle
Reason: image not found - /Users/KaushiK/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.8/lib/mysql2/mysql2.bundle
from /Users/ME/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.8/lib/mysql2.rb:9:in `<top (required)>'
from /Users/ME/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `require'
from /Users/ME/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
from /Users/ME/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `each'
from /Users/ME/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:66:in `block in require'
from /Users/ME/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `each'
from /Users/ME/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler/runtime.rb:55:in `require'
from /Users/ME/.rvm/gems/ruby-1.9.2-p290@global/gems/bundler-1.0.21/lib/bundler.rb:122:in `require'
from /Users/ME/Desktop/MyRailProjects/first_app/config/application.rb:7:in `<top (required)>'
from /Users/ME/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:52:in `require'
from /Users/ME/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:52:in `block in <top (required)>'
from /Users/ME/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:49:in `tap'
from /Users/ME/.rvm/gems/ruby-1.9.2-p290/gems/railties-3.1.1/lib/rails/commands.rb:49:in `<top (required)>'
from script/rails:6:in `require'
from script/rails:6:in `<main>'

I followed a previous thread (http://stackoverflow.com/questions/5394873/trying-to-access-my-ruby-project-loaderror-pertaining-to-mysql) and wrote the following,

 sudo install_name_tool -change libmysqlclient.18.dylib /usr/local/mysql-5.5.10- osx10.7-x86_64/lib/libmysqlclient.18.dylib /Users/ME/.rvm/gems/ruby-1.9.2-p290/gems/mysql2-0.3.8/lib/mysql2/mysql2.bundle 

Which did nothing. I mean it went through then i wrote this.

sudo ln /usr/local/mysql-5.5.10-osx10.7-x86_64/bin/mysql /usr/local/mysql/bin/mysql

When i type this it says

 ln: /usr/local/mysql-5.5.10-osx10.7-x86_64/bin/mysql: No such file or directory

I have no idea why. and I cant see the files and directories even though i enabled view hidden files. I do not know how to debug this.

Upvotes: 0

Views: 317

Answers (1)

colinm
colinm

Reputation: 4288

Unless you absolutely have to use Oracle's broken MySQL 5.5 packages, honestly the easiest solution is to drop back down to 5.1. That said...

When you say install_name tool "did nothing," what do you mean? Did you try building the gem again after that? Giving the appearance of "doing nothing" is the standard state of success for UNIX tools.

Re: the ln, even the newest releases are still tagged 10.6. Unless you've renamed the MySQL directory yourself, it's mysql-5.5.10-osx10.6-x86_64.

Upvotes: 1

Related Questions