bundle install problem: mysql.h is missing

前端 未结 12 1536
迷失自我
迷失自我 2020-12-07 17:02

in my mac OSX 10.6 32 bit, I can install mysql2 gem quite easily, but not in mini mac 10.6 64bit server.

I have installed MySQL 5.5.11 in troublesome server, while i

12条回答
  •  清歌不尽
    2020-12-07 18:00

    This method is for Rails 3.1.0 (and hopefully up) on 64 bit machine. I used on Ruby-1.9.2-p180.

    This blog answered it: http://www.tatvartha.com/2010/10/installing-mysql-gem-with-bundler-on-snow-leopard/

    Basically, the method above: $ sudo env ARCHFLAGS="-arch x86_64" gem install mysql -- --with-mysql-config=/usr/local/mysql/bin/mysql_config

    may work, but without bundler.

    To do it with bundler, first must run this on terminal:

    bundle config build.mysql2 --with-mysql-config=/usr/local/mysql/bin/mysql_config
    

    Note "mysql2" not "mysql" as shown in that blog.

    That adds a config to ~/.bundle/config file

    Then add this to ~/.bash_profile:

    export ARCHFLAGS="-arch x86_64"
    

    That is the same with telling bundler to run the command on top of this post.

提交回复
热议问题