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?


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

  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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