Alessio Caiazza

OSX Lion, ruby and mysql2 - [FATAL] failed to allocate memory

I’ve spent a day figuring out how to solve the “[FATAL] failed to allocate memory” with mysql2 gems on Lion.

This solution should work if you installed mysql with Homebrew.

First of all, remove mysql-connector-c and mysql2 gem

$ brew uninstall mysql-connector-c
$ gem uninstall mysql2

Find the mysql version

$ ls /usr/local/Cellar/mysql                
5.5.19

Now recompile mysql2 against brewed mysql server (replace 5.5.19 with your version (twice))

$ gem install mysql2 -- \
  --with-mysql-include=/usr/local/Cellar/mysql/5.5.19/include \
  --with-mysql-lib=/usr/local/Cellar/mysql/5.5.19/lib

Enjoy yourself

(l0g.in 4GhP00)

This post accepts webmentions. Do you have the URL to your post?