Friday, December 05, 2008

mysql gem on debian

This post will show you how to install the mysql ruby gem on Debian Sarge.

First try:

sudo gem install mysql



2nd try:

sudo gem install mysql -- --with-mysql-config

Maybe you'll get the following output:

Building native extensions.  This could take a while...
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

/usr/local/bin/ruby extconf.rb install mysql -- --with-mysql-config
extconf.rb:1: command not found: mysql_config --cflags
*** 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.

Don't panic that means you don't have the libmysqlclient-dev package that contains the mysql_config file, ok let's install it!

apt-get install libmysqlclient15-dev

We're almost done, the final step is to install the gem telling the compiler where to find the mysql_config file, it should be under the /usr/bin/ directory (check it!)

ok, finally let's install the gem!

gem install gem mysql -- --with-mysql-config=/usr/bin/mysql_config

You can check if the gem is propertly installed using irb:

require 'rubygems'
require 'mysql'


Anonymous said...

thanks. this helped :)

Anonymous said...

yes. thanks alot!

jpemberthy said...

Np, I'm glad that helped you guys.

Anonymous said...
This comment has been removed by a blog administrator.
Peter said...

Pc games free
gta 4 free download