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

前端 未结 3 1007
谎友^
谎友^ 2020-12-19 02:03

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
         


        
相关标签:
3条回答
  • 2020-12-19 02:09

    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.

    0 讨论(0)
  • 2020-12-19 02:27

    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.

    0 讨论(0)
  • 2020-12-19 02:30

    I uninstalled mysql2

    $ gem uninstall mysql2
    

    And reinstalled via bundler

    $ bundle
    

    And I'm able to rails s once again

    0 讨论(0)
提交回复
热议问题