Installing the MySQL Gem in Lion

Nov 9, 2011 by     No Comments    Posted under: Learning Rails, Tech

I kept getting weird permissions errors trying to install the MySQL gem for Ruby 1.9.2. The issue is that I was running the 64-bit version of Ruby with a 32-bit version of MySQL–which is the standard in new Lion installs. To fix, download the 64-bit version of MySQL from mysql.com, install, and then run:

export ARCHFLAGS="-arch i386 -arch x86_64" ; gem install --no-rdoc --no-ri mysql -- --with-mysql-dir=/usr/local --with-mysql-config=/usr/local/mysql/bin/mysql_config