Ruby: Installing the MySQL Ruby gem on Solaris

In order to install the MySQL Ruby gem, the MySQL client libraries must exist on your system.  This typically means you should have the MySQL package installed on your system, or have built and installed MySQL from sources.

If you have not yet installed MySQL you can obtain a pre-built binary package from Sunfreeware (As always THANK YOU to Sunfreeware for all your hard work!) Select your correct architecture and select the MySQL package from the list. You should now see a link that lets you download the pre-built binary package. The packages are in gnuzip format.  If you don't already have gnuzip on your system, you can also download (an uncompressed) tar file of gnuzip.

Assuming you download the mysql package to /tmp, you can install it as follows (example shows version 5.0.67 on Solaris 9):

cd /tmp
gunzip mysql-5.0.67-sol9-sparc-local.gz
pkgadd -d mysql-5.0.67-sol9-sparc-local

This will install mysql to /usr/local/mysql.

Once the install is complete, you can now download and build the MySQL/Ruby gem as follows:

gem install mysql --\
--with-mysql-dir=/usr/local/mysql\
--with-mysql-lib=/usr/local/mysql/lib\
--with-mysql-include=/usr/local/mysql/include

Your MySQL Ruby gem should now be ready for use!