2

I don't know how to install mysql2.

I'm using:

  • Ruby On Rails 3.2.14
  • Ruby 2.0.0
  • Mac OS X 10.9 ("Mavericks")

Installing mysql2 (0.3.13) 

An error occurred while installing mysql2 (0.3.13), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.13'` succeeds before bundling.

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

    /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby extconf.rb 

*** 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.


Gem files will remain installed in /Users/kimingi/.bundler/tmp/1983/gems/mysql2-0.3.13 for inspection.
Results logged to /Users/kimingi/.bundler/tmp/1983/gems/mysql2-0.3.13/ext/mysql2/gem_make.out

An error occurred while installing mysql2 (0.3.13), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.13'` succeeds before bundling.

ERROR:  Error installing mysql2:
    ERROR: Failed to build gem native extension.
the Tin Man
  • 158,662
  • 42
  • 215
  • 303
Ingi Kim
  • 21
  • 1
  • 2
  • 1
    Do you install the libmysqlclient-dev first? – Bigxiang Aug 20 '13 at 03:54
  • One of the problems with living on the bleeding edge of OS versions is you inherit the problems of porting existing code to work on the unknown/new code-base. Installers test for known versions and often vomit badly with unknown ones. – the Tin Man Aug 20 '13 at 04:14
  • Have you seen this http://stackoverflow.com/questions/5409761/installing-mysql2-gem-for-ruby-on-rails-with-mac-osx-10-6 – Arihant Godha Aug 20 '13 at 04:42

2 Answers2

5

You need to install mysql locally. Since you're on OS X you can use Homebrew.

# to Install homebrew
ruby -e "$(curl -fsSL https://raw.github.com/mxcl/homebrew/go)"

# to install mysql through homebrew
brew install mysql
roninblade
  • 1,882
  • 15
  • 15
  • You might add more information about how to install homebrew since it's not a normal part of a Mac OS installation. – the Tin Man Aug 20 '13 at 04:15
0

I ran to the same problem. To fix this problem, open a command prompt. go to your application folder. And type: gem install mysql2 -v 0.3.11 this version is working great.

Lesly Revenge
  • 894
  • 10
  • 16