When installing the ruby mysql gem by doing:

sudo gem install mysql

Subsequent rails migrations still fail, with a message like:

$ rake db:migrate
(in /Users/guy/code/project)
rake aborted!
uninitialized constant MysqlCompat::MysqlRes

(See full trace by running task with --trace)

How can I fix this?

link|improve this question
feedback

1 Answer

up vote 1 down vote accepted

In order to fix this issue (at the time of this question), you'll need to set an additional environment variable during installation.

For a 32-bit platform, do:

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

For a 64-bit platform, do:

sudo env ARCHFLAGS="-arch x86_64" gem install mysql

Once complete, your migrations should succeed (assuming no other factors were impeding the migrations).

link|improve this answer
I'm pretty sure this is the third time I've ended up here. Thanks for this. – Joseph Holsten Apr 15 '11 at 16:48
feedback

Your Answer

 
or
required, but never shown

Not the answer you're looking for? Browse other questions tagged or ask your own question.