# Rails 2.2.2, Mac OS X and MySQL

**URL:** <https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799>\
**Category:** Rails\
**Created:** [March 2, 2009, 3:13pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799 "2009-03-02T15:13:51Z")\
**Posts on this page:** 18\
**Page:** 1

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 3:13pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/1 "2009-03-02T15:13:51Z")

</div>

Hi all,

I hope someone can inform me on this. I was shocked to find that since  
upgrading to Rails 2.2.2 my Rails projects using MySQL have broken.

I have read some webpages that talk about checking whether you have  
libmysqlclient installed (without saying how one might check that!)  
and moving MySQL from 64-bit to 32-bit installation (again, there is  
no indication of how one does this). This is in Mac OS X 10.5.6.

I would really rather not mess about unduly with my MySQL  
installation, since I use it for other purposes. So is there a simple  
way for me to “downgrade” my Rails installation to one that does play  
nicely with MySQL (and which one is that, BTW)?

Thanks,

## Ian.

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 3:37pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/2 "2009-03-02T15:37:53Z")

</div>

Ian P. wrote:

> Hi all,
> 
> I hope someone can inform me on this. I was shocked to find that since  
> upgrading to Rails 2.2.2 my Rails projects using MySQL have broken.

Can you define “broken?” Are you getting errors? If so what are they?  
What version of mysql do you have installed? I’m guessing it was working  
just before you upgraded to Rails 2.2.2, but was there anything else  
that you upgraded in the process? What version of Rails were you running  
before you upgraded to Rails 2.2.2? Did you install a new mysql gem for  
instance do you you have it installed at all?

I had issues with mysql, but it didn’t take much Googling to find a fix.  
So I know for certain that Rails 2.2.2 will work just fine with MySQL,  
as long as you have everything setup correctly. Chances are that if  
you’re having trouble then others have had it already and posted the fix  
on their blog.

If you really do end up needing to downgrade, then I would assume  
uninstalling the Rails 2.2.2 gems should do the trick.

[sudo] gem uninstall rails --version 2.2.2  
[sudo] gem uninstall actionmailer --version 2.2.2  
[sudo] gem uninstall actionpack --version 2.2.2  
…

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 3:49pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/3 "2009-03-02T15:49:14Z")

</div>

On Mon, Mar 2, 2009 at 6:37 AM, Robert W. \<  
removed\_email\_address@domain.invalid\> wrote:

> that you upgraded in the process? What version of Rails were you running  
> uninstalling the Rails 2.2.2 gems should do the trick.
> 
> [sudo] gem uninstall rails --version 2.2.2  
> [sudo] gem uninstall actionmailer --version 2.2.2  
> [sudo] gem uninstall actionpack --version 2.2.2

Hi, one should also be able to install the previous (i.e. 2.1.x) and  
update  
the environment.rb to use it.  
Again, I’m in agreement with the previous post of determining what are  
the  
exact nature of the issues  
that you’re receiving and the relevant version information. How did you  
install MySQL?

Good luck,

-Conrad

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 4:22pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/4 "2009-03-02T16:22:29Z")

</div>

On Mon, Mar 2, 2009 at 7:12 AM, Ian P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> > 
> 
> Is there a page somewhere (I looked but couldn’t find one) that sets  
> Please install the mysql gem and try again: gem install mysql.
> 
> checking for main() in -lm… yes  
> details. You may need configuration options.  
> –srcdir=.  
> –with-mysql-lib  
> –without-mysqlclientlib  
> Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/
> 
> > as long as you have everything setup correctly. Chances are that if  
> > uninstalling the Rails 2.2.2 gems should do the trick.
> 
> ## Ian.

So, where did you install MySQL and what version of it did you  
install?

-Conrad

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 4:13pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/5 "2009-03-02T16:13:37Z")

</div>

On 2 Mar 2009, at 2:37pm, Robert W. wrote:

> working  
> just before you upgraded to Rails 2.2.2, but was there anything else  
> that you upgraded in the process? What version of Rails were you  
> running  
> before you upgraded to Rails 2.2.2? Did you install a new mysql gem  
> for  
> instance do you you have it installed at all?

Yes, of course - I should have done that initially but I didn’t want  
to clutter the posting. See below.

I suppose what gets me irritated about this is that I had no prior  
knowledge that upgrading Rails was going to disable what is probably  
the most commonly-used database setup for Rails. Presumably there was  
a good reason to remove the bundled MySQL driver, but I don’t know  
what it is. I haven’t changed anything else on my system (apart from  
Mac OS X updates) since I installed the machine nearly two years ago.

Is there a page somewhere (I looked but couldn’t find one) that sets  
out the potentially adverse implications of upgrading to a particular  
version of Rails? Seems like it would be a help.

Anyway, back to the error:

I can create a new Rails project using rails -d mysql myproject with  
no problem, but when I run rake db:create:all I see this error message:

========= message ========  
!!! The bundled mysql.rb driver has been removed from Rails 2.2.  
Please install the mysql gem and try again: gem install mysql.  
rake aborted!  
no such file to load – mysql  
========= message ========

Then when I run sudo gem install mysql I see this:

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

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby  
extconf.rb install mysql

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

/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby  
extconf.rb install mysql  
checking for mysql\_query() in -lmysqlclient… no  
checking for main() in -lm… yes  
checking for mysql\_query() in -lmysqlclient… no  
checking for main() in -lz… yes  
checking for mysql\_query() in -lmysqlclient… no  
checking for main() in -lsocket… no  
checking for mysql\_query() in -lmysqlclient… no  
checking for main() in -lnsl… no  
checking for mysql\_query() in -lmysqlclient… no  
\*\*\* 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.

Provided configuration options:  
–with-opt-dir  
–without-opt-dir  
–with-opt-include  
–without-opt-include=${opt-dir}/include  
–with-opt-lib  
–without-opt-lib=${opt-dir}/lib  
–with-make-prog  
–without-make-prog  
–srcdir=.  
–curdir  
–ruby=/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/  
ruby  
–with-mysql-config  
–without-mysql-config  
–with-mysql-dir  
–without-mysql-dir  
–with-mysql-include  
–without-mysql-include=${mysql-dir}/include  
–with-mysql-lib  
–without-mysql-lib=${mysql-dir}/lib  
–with-mysqlclientlib  
–without-mysqlclientlib  
–with-mlib  
–without-mlib  
–with-mysqlclientlib  
–without-mysqlclientlib  
–with-zlib  
–without-zlib  
–with-mysqlclientlib  
–without-mysqlclientlib  
–with-socketlib  
–without-socketlib  
–with-mysqlclientlib  
–without-mysqlclientlib  
–with-nsllib  
–without-nsllib  
–with-mysqlclientlib  
–without-mysqlclientlib

Gem files will remain installed in /Library/Ruby/Gems/1.8/gems/  
mysql-2.7 for inspection.  
Results logged to /Library/Ruby/Gems/1.8/gems/mysql-2.7/gem\_make.out  
========= message ========

> I had issues with mysql, but it didn’t take much Googling to find a  
> fix.  
> So I know for certain that Rails 2.2.2 will work just fine with MySQL,  
> as long as you have everything setup correctly. Chances are that if  
> you’re having trouble then others have had it already and posted the  
> fix  
> on their blog.

Well, yes, but like I said, the explanation is not that clear. For  
example, I don’t know how to check whether libmysqlclient is  
installed. Or how to swap from 64-bit MySQL to 32-bit MySQL.

> If you really do end up needing to downgrade, then I would assume  
> uninstalling the Rails 2.2.2 gems should do the trick.
> 
> [sudo] gem uninstall rails --version 2.2.2  
> [sudo] gem uninstall actionmailer --version 2.2.2  
> [sudo] gem uninstall actionpack --version 2.2.2

I may have to try that if I can’t fix the current broken state. As an  
alternative, I suppose I could specify an earlier Rails version in my  
environment.rb file.

Thanks,

## Ian.

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 4:36pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/6 "2009-03-02T16:36:02Z")

</div>

On 2 Mar 2009, at 3:21pm, Conrad T. wrote:

> So, where did you install MySQL and what version of it did you  
> install?
> 
> -Conrad

/usr/local/mysql - that was the location that the installer chose. I  
am currently running MySQL version 5.0.45 on an Intel iMac with Mac OS  
X 10.5.6. And I haven’t changed anything recently apart from upgrading  
from Rails 2.1.0 (where things worked fine) to Rails 2.2.2 (where they  
don’t).

🙂

## Ian.

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 4:44pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/7 "2009-03-02T16:44:50Z")

</div>

On Mon, Mar 2, 2009 at 7:35 AM, Ian P. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> X 10.5.6. And I haven’t changed anything recently apart from upgrading  
> from Rails 2.1.0 (where things worked fine) to Rails 2.2.2 (where they  
> don’t).
> 
> 🙂

OK, where is the following file located:

mysql\_config

Once you located the parent directory of the above file, you should be  
able  
to  
do the following:

sudo gem install kwatch-mysql-ruby –  
–with-mysql-config=\<insert\_parent\_directory\_here\>/mysql\_config

Good luck,

-Conrad

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 4:52pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/8 "2009-03-02T16:52:30Z")

</div>

Ian P. wrote:

> Then when I run sudo gem install mysql I see this:

On Mac OS X you can’t just simply run sudo gem install mysql. You must  
use the instructions that are specific to Mac OS X.

This really has to do with the nature of Mac OS X Leopard and is  
somewhat unrelated to Rails or Ruby.

Mac OS X 10.5 (Leopard) builds universal binaries by default. However,  
most installations of MySQL on Mac OS 10.5 are Intel only so you must  
tell the gcc compiler to build for your specific platform: i386 or ppc.

Here is the command to use to install the mysql gem for Intel:

sudo env ARCHFLAGS="-arch i386" gem install mysql  
–with-mysql-config=/usr/local/mysql/bin/mysql\_config

Note: That is all one line.

However, you may still have an issue with one of the dynamic libraries.  
This is where I had an issue with my install.

Here is the fix:

sudo install\_name\_tool -change  
/usr/local/mysql/lib/mysql/libmysqlclient.15.dylib  
/usr/local/mysql/libmysqlclient.15.dylib  
/Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle

Note: You may need to confirm the paths in that command, because some of  
the blogs I tried didn’t have it correct and I’m not sure if this one is  
one of those. So make sure the libmysqlclient.15.dylib is actually in  
the location specified above. Same goes for the mysql.bundle path.

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 5:00pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/9 "2009-03-02T17:00:12Z")

</div>

On Mon, Mar 2, 2009 at 7:52 AM, Robert W. \<  
removed\_email\_address@domain.invalid\> wrote:

> ## Mac OS X 10.5 (Leopard) builds universal binaries by default. However, However, you may still have an issue with one of the dynamic libraries. the blogs I tried didn’t have it correct and I’m not sure if this one is one of those. So make sure the libmysqlclient.15.dylib is actually in the location specified above. Same goes for the mysql.bundle path.
> 
> Posted via [http://www.ruby-forum.com/](http://www.ruby-forum.com/).

Hi, I have both Intel and G5 Macs and I was able to simply install MySQL  
without  
requiring any architecture flags.

-Conrad

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 5:08pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/10 "2009-03-02T17:08:52Z")

</div>

Conrad T. wrote:

> Hi, I have both Intel and G5 Macs and I was able to simply install MySQL  
> without  
> requiring any architecture flags.

I didn’t say it was required to install MySQL. It is, however, necessary  
for installing the mysql gem using RubyGems on Mac OS X Leopard.

Note: It’s not required for Mac OS X 10.4 (Tiger).

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 5:12pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/11 "2009-03-02T17:12:05Z")

</div>

On Mon, Mar 2, 2009 at 8:08 AM, Robert W. \<  
removed\_email\_address@domain.invalid\> wrote:

> 

Hi, I’m running Mac OS X Leopard and it’s not required on my systems.

-Conrad

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 5:06pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/12 "2009-03-02T17:06:08Z")

</div>

On 2 Mar 2009, at 3:44pm, Conrad T. wrote:

> am currently running MySQL version 5.0.45 on an Intel iMac with Mac OS  
> Once you located the parent directory of the above file, you should  
> be able to  
> do the following:
> 
> sudo gem install kwatch-mysql-ruby – --with-mysql-  
> config=\<insert\_parent\_directory\_here\>/mysql\_config

Thanks - unfortunately, this didn’t work… here is the transcript:

# ===== frost:euops ian$ which mysql\_config /usr/local/mysql/bin/mysql\_config frost:euops ian$ sudo gem install kwatch-mysql-ruby – --with-mysql- config=/usr/local/mysql/bin/mysql\_config Building native extensions. This could take a while… Successfully installed kwatch-mysql-ruby-2.8.1 1 gem installed frost:euops ian$ rake db:create:all (in /Users/ian/projects/rails/euops) !!! The bundled mysql.rb driver has been removed from Rails 2.2. Please install the mysql gem and try again: gem install mysql. rake aborted! dlopen(/Library/Ruby/Gems/1.8/gems/kwatch-mysql-ruby-2.8.1/lib/ mysql.bundle, 9): Library not loaded: /usr/local/mysql/lib/mysql/ libmysqlclient.15.dylib Referenced from: /Library/Ruby/Gems/1.8/gems/kwatch-mysql- ruby-2.8.1/lib/mysql.bundle Reason: image not found - /Library/Ruby/Gems/1.8/gems/kwatch-mysql- ruby-2.8.1/lib/mysql.bundle

though the bundle is there:

# ===== frost:euops ian$ ls -al /Library/Ruby/Gems/1.8/gems/kwatch-mysql- ruby-2.8.1/lib/ total 352 drwxr-xr-x 3 root admin 102 2 Mar 15:50 . drwxr-xr-x 12 root admin 408 2 Mar 15:50 … -rwxr-xr-x 1 root admin 176560 2 Mar 15:50 mysql.bundle

Would it make sense to completely clear out my Rails installation and  
start again?

BTW, regarding Robert’s posting about architecture flags, I have never  
done this on my Intel Macs and never previously had a problem. So I  
don’t think that’s the answer (though I could be wrong - wouldn’t be  
the first time).

## Ian.

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 5:16pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/13 "2009-03-02T17:16:13Z")

</div>

Robert W. wrote:

> Conrad T. wrote:
> 
> > Hi, I have both Intel and G5 Macs and I was able to simply install MySQL  
> > without  
> > requiring any architecture flags.
> 
> I didn’t say it was required to install MySQL. It is, however, necessary  
> for installing the mysql gem using RubyGems on Mac OS X Leopard.
> 
> Note: It’s not required for Mac OS X 10.4 (Tiger).

By the way that command for installing the mysql gem I posted was  
straight out of the instructions in comments at the top of the  
database.yml file for a new Rails 2.2.2 project, which looks something  
like:

# MySQL. Versions 4.1 and 5.0 are recommended.

# 

# Install the MySQL driver:

# gem install mysql

# On Mac OS X:

# sudo gem install mysql – --with-mysql-dir=/usr/local/mysql

# On Mac OS X Leopard:

# sudo env ARCHFLAGS="-arch i386" gem install mysql –

–with-mysql-config=/usr/local/mysql/bin/mysql\_config

# This sets the ARCHFLAGS environment variable to your native

architecture

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 5:22pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/14 "2009-03-02T17:22:58Z")

</div>

Robert W. wrote:

> # On Mac OS X Leopard:
> 
> # sudo env ARCHFLAGS="-arch i386" gem install mysql –
> 
> –with-mysql-config=/usr/local/mysql/bin/mysql\_config
> 
> # This sets the ARCHFLAGS environment variable to your native
> 
> architecture

I just realized that the command I posted earlier was missing the extra  
– after mysql and before --with-my…

So make sure you use the command exactly as above and it should work  
fine. If you happen to have a PowerPC based mac running leopard, be sure  
to switch out -i386 with -ppc.

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 5:32pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/15 "2009-03-02T17:32:49Z")

</div>

On Mon, Mar 2, 2009 at 8:22 AM, Robert W. \<  
removed\_email\_address@domain.invalid\> wrote:

> So make sure you use the command exactly as above and it should work  
> fine. If you happen to have a PowerPC based mac running leopard, be sure  
> to switch out -i386 with -ppc.

I guess it really depends on your environment because I have been  
install  
MySQL gems  
for over a year with having to require the architecture. Every  
environment  
is different.

-Conrad

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 5:34pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/16 "2009-03-02T17:34:01Z")

</div>

On Mon, Mar 2, 2009 at 8:31 AM, Conrad T. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)  
wrote:

> > I just realized that the command I posted earlier was missing the extra  
> > – after mysql and before --with-my…
> > 
> > So make sure you use the command exactly as above and it should work  
> > fine. If you happen to have a PowerPC based mac running leopard, be sure  
> > to switch out -i386 with -ppc.

I guess it really depends on your environment because I have been  
installing  
MySQL gems  
for over a year without having to require the architecture. Every  
environment is different.

-Conrad

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 6:28pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/17 "2009-03-02T18:28:50Z")

</div>

On 2 Mar 2009, at 4:22pm, Robert W. wrote:

> – after mysql and before --with-my…
> 
> So make sure you use the command exactly as above and it should work  
> fine. If you happen to have a PowerPC based mac running leopard, be  
> sure  
> to switch out -i386 with -ppc.

OK, sorted. Thanks for all of your help. Here, for the record, is what  
I did, based on your collected suggestions:

1. I ran this command (all on one line):  
sudo env ARCHFLAGS="-arch i386" gem install mysql – --with-mysql-  
config=/usr/local/mysql/bin/mysql\_config

2. I did the install\_name\_tool thing (also all on one line - note the  
paths carefully - the first is the wrong path, the second is the  
correct path and the third should also be correct):  
sudo install\_name\_tool -change /usr/local/mysql/lib/mysql/  
libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.15.dylib

3. To test, I created a new mysql project, changed to the project  
folder, edited the username and password in config/database.yml and  
then typed rake db:create:all. This just returned the command prompt  
with no error.

Here is the transcript:

==== transcript ====

frost:rails ian$ sudo env ARCHFLAGS="-arch i386" gem install mysql –  
–with-mysql-config=/usr/local/mysql/bin/mysql\_config  
Building native extensions. This could take a while…  
Successfully installed mysql-2.7  
1 gem installed

frost:rails ian$ sudo install\_name\_tool -change /usr/local/mysql/lib/  
mysql/libmysqlclient.15.dylib /usr/local/mysql/lib/libmysqlclient.  
15.dylib /Library/Ruby/Gems/1.8/gems/mysql-2.7/lib/mysql.bundle

frost:rails ian$ rails -d mysql dbtest

frost:rails ian$ cd dbtest

frost:dbtest ian$ rake db:create:all

==== transcript ====

## Ian.

---

<div class="post-metadata">

**Author:** ![nevermoo](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/n/ce73a5/32.png) [@nevermoo](https://www.ruby-forum.com/u/nevermoo)\
**Post date:** [March 2, 2009, 6:35pm UTC](https://www.ruby-forum.com/t/rails-2-2-2-mac-os-x-and-mysql/161799/18 "2009-03-02T18:35:52Z")

</div>

Ian - if I’m not mistaken, kwatch-mysql-ruby provides mysql-2.8.1  
which is the correct version for Ruby-1.9.+. You only said your  
upgrade was to Rails 2.2 and your gems messages indicate /System/  
Library/…/gems/1.8/gems so I’m guessing you are still running Ruby  
1.8.[67].

Try the install that you used for kwatch but instead of “kwatch-mysql-  
ruby” use “mysql-ruby” that ought to work for you.
