Installing mysql gem on MAC OS + XAMPP + Rails 2.3

8
Nov
0

If you are on a MAC, using the easy going XAMPP and need that rails app to get up and running using mysql, then read on.

So Rails 2 does not come with the mysql gem installed.

You run:
gem install mysql

and to your shock you get:
ERROR: Error installing mysql:
ERROR: Failed to build gem native extension.

And in your log you see:
no such file to load — mysql

Before you do anything, make sure you download the “developer package” from XAMPP website.

Then in your terminal run this command:

sudo env ARCHFLAGS=”-arch i386″ gem install mysql — –with-mysql-dir=/Applications/XAMPP/xamppfiles/lib/mysql –with-mysql-lib=/Applications/XAMPP/xamppfiles/lib/mysql/ –with-mysql-include=/Applications/XAMPP/xamppfiles/include/mysql/

And finally, it worked!

Enjoy this article?

Consider subscribing to our RSS feed!

Filed under: Ruby on Rails

// No Comments

No comments yet.

Leave a comment

RSS feed for comments on this post