小编ase*_*der的帖子

如何在Ruby 1.9.3下安装mysql2 gem?在2.0.0下工作

我在我的机器上安装mysql2 gem时遇到了麻烦.

我有OS X 10.8和最新的Xcode,以及通过Homebrew安装的mySql.使用最新RVM安装的所有rubies.

我可以在ruby 2.0.0-p195下安装mysql2

[~]$ rvm use 2.0.0                                                              [ruby-1.9.3-p429]
Using /Users/aselder/.rvm/gems/ruby-2.0.0-p195
[~]$ gem in mysql2                                                              [ruby-2.0.0-p195]
Fetching: mysql2-0.3.11.gem (100%)
Building native extensions.  This could take a while...
Successfully installed mysql2-0.3.11
1 gem installed
Run Code Online (Sandbox Code Playgroud)

在Ruby 1.9.3和1.8.7下,它找不到mysql.h文件

    [~]$ rvm use 1.9.3                                                              [ruby-1.9.3-p429]
    Using /Users/aselder/.rvm/gems/ruby-1.9.3-p429
    [~]$ gem in mysql2                                                              [ruby-1.9.3-p429]
    Fetching: mysql2-0.3.11.gem (100%)
    Building native extensions.  This could take a while...
    ERROR:  Error installing mysql2:
        ERROR: Failed to build gem native extension.

            /Users/aselder/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb
    checking for rb_thread_blocking_region()... yes
    checking for …
Run Code Online (Sandbox Code Playgroud)

ruby homebrew bundler mysql2

5
推荐指数
1
解决办法
5509
查看次数

标签 统计

bundler ×1

homebrew ×1

mysql2 ×1

ruby ×1