0

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

I am new to Ruby on rails. I am running this command rake db:create but I am getting following errors. I do have installed mysql.

Zafars-MacBook-Pro:erierb zafar$ rake db:create
rake aborted!
 dlopen(/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle, 9):     Library not loaded: libmysqlclient.18.dylib
  Referenced from: /Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
  Reason: image not found - /Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/mysql2-0.3.11/lib/mysql2/mysql2.bundle
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `require'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/mysql2-0.3.11/lib/mysql2.rb:9:in `<top (required)>'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `require'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler/runtime.rb:68:in `block (2 levels) in require'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `each'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler/runtime.rb:66:in `block in require'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `each'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler/runtime.rb:55:in `require'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/gems/bundler-1.2.3/lib/bundler.rb:128:in `require'
/Users/zafar/Desktop/erierb/config/application.rb:13:in `<top (required)>'
/Users/zafar/Desktop/erierb/Rakefile:5:in `require'
/Users/zafar/Desktop/erierb/Rakefile:5:in `<top (required)>'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/bin/ruby_noexec_wrapper:14:in `eval'
/Users/zafar/.rvm/gems/ruby-1.9.3-p374/bin/ruby_noexec_wrapper:14:in `<main>'
(See full trace by running task with --trace)

Following is my database.yml file

development:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: erierb_development
  pool: 5
  username: root
  password:
  socket: /tmp/mysql.sock

test:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: erierb_test
  pool: 5
  username: root
  password:
  socket: /tmp/mysql.sock

production:
  adapter: mysql2
  encoding: utf8
  reconnect: false
  database: erierb_production
  pool: 5
  username: root
  password:
  socket: /tmp/mysql.sock

Here is my gemfile

source 'https://rubygems.org'

    gem 'rails', '3.2.11'

    # Bundle edge Rails instead:
    # gem 'rails', :git => 'git://github.com/rails/rails.git'

    gem 'mysql2'


    # Gems used only for assets and not required
    # in production environments by default.
    group :assets do
      gem 'sass-rails',   '~> 3.2.3'
      gem 'coffee-rails', '~> 3.2.1'

      # See https://github.com/sstephenson/execjs#readme for more supported runtimes
      # gem 'therubyracer', :platforms => :ruby

      gem 'uglifier', '>= 1.0.3'
    end

    gem 'jquery-rails'

    group :development, :test do
      gem 'rspec-rails'
    end

    # To use ActiveModel has_secure_password
    gem 'bcrypt-ruby', '~> 3.0.0'
Community
  • 1
  • 1
Om3ga
  • 30,465
  • 43
  • 141
  • 221
  • 1
    http://stackoverflow.com/questions/10557507/rails-mysql-on-osx-library-not-loaded-libmysqlclient-18-dylib http://stackoverflow.com/questions/4546698/library-not-loaded-libmysqlclient-16-dylib-error-when-trying-to-run-rails-serv – halfelf Feb 05 '13 at 07:12
  • http://stackoverflow.com/questions/5024353/issue-in-installing-mysql2-gem-with-rails3-on-mac – sunnyrjuneja Feb 05 '13 at 07:14

0 Answers0