Fix for Rails 3.x.x error “[FATAL] failed to allocate memory” in OS X Lion

This error happens when mysql2 gem is either installed for some other version of mysql or when it cannot find required dynamic library. To fix this error, uninstall mysql2 gem and install as follows
[code]$ env ARCHFLAGS="-arch x86_64" gem install mysql2 -v='0.3.11' -- --with-mysql-dir=/usr/local/mysql --with-mysql-lib=/usr/local/mysql/lib --with-mysql-include=/usr/local/mysql/include --with-mysql-config=/usr/local/mysql/bin/mysql_config[/code]
Please change '/usr/local/mysql' to your mysql installation path. Thank you.

Leave a Comment