0
votes

I'm using Ruby on rails (RubyMine) and I try starting my project. Which tells me the error "Could not find gem 'mysql2 (~> 0.2.6, runtime)' in any of the gem sources listed in your Gemfile. (Bundler::GemNotFound)".

I've done sudo gem install mysql which gives me

"Error installing mysql: ERROR: Failed to build gem native extension. Gem files will remain installed in /var/lib/gems/1.8/gems/mysql-2.8.1 for inspection. Results logged to /var/lib/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out "

What should I do?

2
You're probably missing a dependency to build mysql. Open /var/lib/gems/1.8/gems/mysql-2.8.1/ext/mysql_api/gem_make.out and see what failed.Jim Schubert

2 Answers

1
votes

You're probably missing the development headers for MySQL. Often this is shipped as an optional package to install. You may need to install mysql-dev or mysql-devel depending on your package manager.

You might also be missing a compiler, so check that you have the required dependencies for gem such as make and gcc.

0
votes

You might be missing the Ruby development headers as well. On my Ubuntu 11.04 box I have the following aptitude package which is needed for native gem compilation:

ruby1.9.1-dev