Matt Connolly's Blog

my brain dumps here…

Installing mysql2 gem on OpenIndiana

Quick one, with mysql 5.1 installed from standard OpenIndiana package repository, the ruby mysql2 gem can be installed with this command:

$ gem install mysql2 -v '0.2.18' -- --with-mysql-dir=/usr/mysql/5.1 --with-mysql-include=/usr/mysql/5.1/include/mysql

This one requires /usr/gnu/bin in the front(ish) of your path, so you may need an `export PATH=/usr/gnu/bin:$PATH` before you do this.




This also works for the latest version ‘0.3.11’:

$ gem install mysql2 -v '0.3.11' -- --with-mysql-dir=/usr/mysql/5.1 --with-mysql-include=/usr/mysql/5.1/include/mysql

[UPDATE 2 – ruby-2.0.0]

Ruby 2.0.0 compiles as a 64-bit executable, which means another bit needs to be added to the command line options:

$ gem install mysql2 -v '0.3.11'-- --with-mysql-dir=/usr/mysql/5.1/ --with-mysql-include=/usr/mysql/5.1/include/mysql --with-mysql-lib=/usr/mysql/5.1/lib/amd64/mysql

3 responses to “Installing mysql2 gem on OpenIndiana

  1. jfqd 17 March, 2013 at 03:18

    If you use OpenCSW you need to patch /opt/csw/bin/mysql_config before installing the mysql or mysql2 gem!

    sed -r -i ‘s/-xarch=386 -mt/ /’ /opt/csw/bin/mysql_config
    sed -r -i ‘s/-xarch=386/ /’ /opt/csw/bin/mysql_config
    gem install mysql2 -v0.2.18 — –with-mysql-config=/opt/csw/bin/mysql_config

    And everything will install just fine! Took me a day to figure it out…

    • mattconnolly 17 March, 2013 at 07:57

      Thanks for that note. Hopefully others using openCSW can find it here and you can save them some time!

      Are you using Ruby 2.0 which now compiles in 64 bit? (Previous rubies only compiled in 32 bit on Solaris-like systems as far as I know.) I noticed a few other libraries where I had to recompile the libraries in 64 bit, or provide 64 bit lib paths to make them work with Ruby 2.0.

  2. jfqd 25 March, 2013 at 04:44

    No not yet, but i tried to get it compiled with rvm – which failed. Will dig deeper if I have time for it 🙂

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: