I have serious problem with Ruby and OSX Lion - whenever I try to start Rails or even a rake tool I am getting this error:
[FATAL] failed to allocate memory
I had a conflicting package mysql-connector-c from homebrew installed. mysql2 used the dylib from this package and not from the mysql install.
Removing the homebrew package yielded another problem, which could be solved by adding
export DYLD_LIBRARY_PATH="$DYLD_LIBRARY_PATH:/usr/local/mysql/lib/"
to my environment.