I'm running Ubuntu 14 and when I try to run rails server
but I get this error:
Could not find gem 'mysql2 (>= 0) ruby' in the gems available on this machine. Run
bundle install
to install missing gems.
So I run the bundle install
and then I get the following error.
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby2.1 extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h extconf failed, exit code 1 Gem files will remain installed in /var/lib/gems/2.1.0/gems/mysql2-0.3.16 for inspection. Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/mysql2-0.3.16/gem_make.out An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling.
So I run gem install mysql2 -v '0.3.16'
and it installs successfully however when I run bundle install
again it gives me the same error:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension. /usr/bin/ruby2.1 extconf.rb mkmf.rb can't find header files for ruby at /usr/lib/ruby/include/ruby.h extconf failed, exit code 1 Gem files will remain installed in /var/lib/gems/2.1.0/gems/mysql2-0.3.16 for inspection. Results logged to /var/lib/gems/2.1.0/extensions/x86_64-linux/2.1.0/mysql2-0.3.16/gem_make.out An error occurred while installing mysql2 (0.3.16), and Bundler cannot continue. Make sure that `gem install mysql2 -v '0.3.16'` succeeds before bundling.
build-essential
and other header files. – sevenseacatrvm.io
in the long run if you're serious about RoR development. – lurker