Take the 2-minute tour ×
Server Fault is a question and answer site for system and network administrators. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

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).

share|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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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