Joe
Joe

Reputation: 795

Trying to bundle install with mysql gem and it fails on MAC

I am looked through stackoverflow and can't seem to find a clear resolution to my problem.

I have tried to install the mysql gem in the following approaches:

  1. bundle install
  2. gem install mysql
  3. brew install mysql

None of which worked.

I receive the following error message:

 Fetching: mysql-2.9.1.gem (100%)
 Building native extensions with: '--with-mysql-config=/usr/local/mysql/bin/mysql_config'
 This could take a while...
 ERROR:  Error installing mysql:
        ERROR: Failed to build gem native extension.

    /Users/josephfleck/.rvm/rubies/ruby-1.9.3-p547/bin/ruby extconf.rb --with-mysql-> config=/usr/local/mysql/bin/mysql_config
 *** extconf.rb failed ***
 Could not create Makefile due to some reason, probably lack of
 necessary libraries and/or headers.  Check the mkmf.log file for more
 details.  You may need configuration options.

 Provided configuration options:
        --with-opt-dir
        --with-opt-include
        --without-opt-include=${opt-dir}/include
        --with-opt-lib
        --without-opt-lib=${opt-dir}/lib
        --with-make-prog
        --without-make-prog
        --srcdir=.
        --curdir
        --ruby=/Users/josephfleck/.rvm/rubies/ruby-1.9.3-p547/bin/ruby
        --with-mysql-config
 extconf.rb:30:in ``': No such file or directory - /usr/local/mysql/bin/mysql_config --cflags 
(Errno::ENOENT)
        from extconf.rb:30:in `<main>'

I am trying to install on a rvm with ruby 1.9.3

Machine: MAC Book pro OS X version 10.9.3

Any help would be appreciated.

Thank you

Upvotes: 0

Views: 865

Answers (2)

Pandya M. Nandan
Pandya M. Nandan

Reputation: 682

first you need to install mysql2 gem. Secondly, check your mkmf.log file. It will contain list of native libraries that failed to installed. If the extension is correctly installed, 'yes' would be written against it. For the failed extension, 'No' or 'Fail' would be written. Try to install those first and then install mysql2 gem.

Better share your log file if not sure which entension failed to install

Or this this may also help

Upvotes: 0

Patrick Oscity
Patrick Oscity

Reputation: 54674

After installing MySQL with brew install mysql, you should use the mysql2 gem.

Upvotes: 2

Related Questions