Mac OSX Lion and Ruby - [FATAL] failed to allocate memory

只愿长相守 提交于 2019-11-29 09:50:08

It took me some time to figure it out but here is the solution:

This problem was caused by mysql2 gem, when I switched to ruby-mysql it all started working again (remember to change adapter from mysql2 to mysql in your database.yml!)

So I started thinking about differences between mac mini and iMac. Basically the mini is running Lion upgraded from Snow Leopard, which is upgraded Leopard and it has good, old Mac Ports for mysql and pgsql servers. So when gem is compiled its using port libraries.

On the other hand the iMac with fresh Lion installation has Zend Server package (apache + php + mysql binaries) and a Homebrew package 'mysql-connector-c' that has libraries needed to compile gem.

All in all it seems as if ports version of mysql works correctly whereas Homewbrew connector does not (its leaking some memory?).

Hope this helps.

I uninstalled mysql2

$ gem uninstall mysql2

And reinstalled via bundler

$ bundle

And I'm able to rails s once again

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.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!