Ruby Gem Mysql Mac 10.6.8

Ruby Gem Mysql Mac 10.6.8,mysql,ruby-on-rails,ruby,macos,Mysql,Ruby On Rails,Ruby,Macos,我想为我在Github上开发的开源应用程序创建一个MySQL数据库:。它是一个Rails 4代码库,并为数据库使用SQL后端。我已经完成了所有步骤,但: 当I$rake db:schema:load 答案是 Could not find mysql2-0.3.14 in any of the sources Run `bundle install` to install missing gems. 我运行bundle安装,但是 $ gem install mysql Building nati

我想为我在Github上开发的开源应用程序创建一个MySQL数据库:。它是一个Rails 4代码库,并为数据库使用SQL后端。我已经完成了所有步骤,但:

当I
$rake db:schema:load

答案是

Could not find mysql2-0.3.14 in any of the sources
Run `bundle install` to install missing gems.
我运行bundle安装,但是

$ gem install mysql
Building native extensions.  This could take a while...
ERROR:  Error installing mysql:
    ERROR: Failed to build gem native extension.

    /User/.rvm/rubies/ruby-1.9.3-p429/bin/ruby extconf.rb
checking for mysql_query() in -lmysqlclient... *** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.

Provided configuration options:
    --with-opt-dir
    --with-opt-include
    --without-opt-include=${opt-dir}/include
    --with-opt-lib
    --without-opt-lib=${opt-dir}/lib
    --with-make-prog
    --without-make-prog
    --srcdir=.
    --curdir
    --ruby=/User/.rvm/rubies/ruby-1.9.3-p429/bin/ruby
    --with-mysql-config
    --without-mysql-config
    --with-mysql-dir
    --without-mysql-dir
    --with-mysql-include
    --without-mysql-include=${mysql-dir}/include
    --with-mysql-lib
    --without-mysql-lib=${mysql-dir}/lib
    --with-mysqlclientlib
    --without-mysqlclientlib
/User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:381:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:870:in `block in find_library'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:254:in `open'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
    from /User/.rvm/rubies/ruby-1.9.3-p429/lib/ruby/1.9.1/mkmf.rb:866:in `find_library'
    from extconf.rb:39:in `<main>'

extconf failed, exit code 1

Gem files will remain installed in /User/.rvm/gems/ruby-1.9.3-p429/gems/mysql-2.9.1 for inspection.
Results logged to /User/.rvm/gems/ruby-1.9.3-p429/extensions/x86_64-darwin-10/1.9.1/mysql-2.9.1/gem_make.out

要回答有关从终端安装mysql gem的问题,请尝试运行:

gem install mysql2

问题解决了。我确实需要重新安装相应的xCode版本,然后问题就解决了。不,我已正确安装并运行mysql2

谢谢,majioa。我已经更新了这篇文章。我没有看到其中的错误,它发生的完全相同:
构建本机扩展。这可能需要一段时间。。。错误:安装mysql2时出错:错误:无法生成gem本机扩展/User/.rvm/rubies/ruby-1.9.3-p392/bin/ruby extconf.rb检查ruby/thread.h..**extconf.rb失败***由于某种原因无法创建Makefile,可能是缺少必要的库和/或头。有关详细信息,请查看mkmf.log文件。您可能需要配置选项。
您是否在Xcode中启用了命令行工具?查看此帖子:
gem install mysql2