Ramblings

May 27, 2010

Ruby, OS X, MAMP, MySQL, do_mysql and getting it installed

Filed under: install, mysql, osx, ruby, tip — michaelangela @ 7:33 am

This took a lot of time. In hopes that this will help someone else, I add this link.

How to install the MySQL/Ruby gem on Mac OS X Leopard

Here’s the situation. I have MAMP. For legacy reasons my current MAMP 1.7.2 is in a custom directory. I use ruby. In particular I wanted to use DataMapper in a project with ruby. I wanted to use it with MySQL. That requires do_mysql. It just would not install with all kinds of errors. Well one in particular. It complained of possibly missing headers or libraries. After a long search the above link surfaced from the depths of Google. It almost worked for me. Everything but the last command actually. So for me, the command I ended up using is something like:

sudo env ARCHFLAGS=”-arch i386″ gem install mysql — –with-mysql-dir=/Applications/MAMP_1.7.2/Library –with-mysql-include=/Applications/MAMP_1.7.2/Library/include/mysql –with-mysql-config=/Applications/MAMP_1.7.2/Library/bin/mysql_config

This is OS X 10.5.8 Leopard

Advertisements

2 Comments »

  1. You might want to change the gem command to reference the do_mysql gem rather than the mysql gem since DataMapper only works with do_mysql.

    I’m not entirely sure how much of the –with-mysq-* options are required if you specify the -with-mysql-config setting. The do_mysql install process should be able to infer all of those given the path to the mysql_config binary.

    Also, if the path to mysql_config (or mysql_config5) is within your $PATH, I’m not sure any of those –with-mysql options are necessary.

    The ARCHFLAGS you use may still be needed to ensure you compile the gem in 32 bit mode, assuming that your system would otherwise compile them in 64 bit mode. For a ruby gem to work with mysql, it must be compiled with the same settings as both ruby *and* mysql. If either is compiled in 32 bit, and the other in 64 bit mode, it won’t work.

    Comment by dkubb — May 27, 2010 @ 7:41 pm

    • Yeah I tried umpteen variations based on what I saw while scouring the web and I narrowed it down to these as being required. Take one out and it fails to install and my box for reasons not quite known to me. And mysql_config is in my path which was also part of my confusion. “Why doesn’t it work!” 🙂 I’ll update the post for do_mysql as well.

      Thanks!

      Comment by michaelangela — May 28, 2010 @ 12:08 am


RSS feed for comments on this post. TrackBack URI

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com 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 )

Google+ photo

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

Connecting to %s

Create a free website or blog at WordPress.com.

%d bloggers like this: