如果它有所不同,我刚刚更新到Mountain Lion,我不知道这是否使这个过程变得复杂。
我正在尝试使用将连接到MySql数据库的Sinatra应用程序。我已经设置了Gemfile并运行bundle install
并获得以下输出:
Fetching gem metadata from http://rubygems.org/.....
Using haml (3.1.6)
Installing mysql2 (0.3.11) with native extensions
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.
/Users/brad/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb
checking for rb_thread_blocking_region()... *** 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=/Users/brad/.rvm/rubies/ruby-1.9.3-p194/bin/ruby
/Users/brad/.rvm/rubies/ruby-1.9.3-p194/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 /Users/brad/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:461:in `try_link0'
from /Users/brad/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:476:in `try_link'
from /Users/brad/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:619:in `try_func'
from /Users/brad/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:894:in `block in have_func'
from /Users/brad/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:790:in `block in checking_for'
from /Users/brad/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block (2 levels) in postpone'
from /Users/brad/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/brad/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:284:in `block in postpone'
from /Users/brad/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/brad/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:280:in `postpone'
from /Users/brad/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:789:in `checking_for'
from /Users/brad/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/mkmf.rb:893:in `have_func'
from extconf.rb:9:in `<main>'
Gem files will remain installed in /Users/brad/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11 for inspection.
Results logged to /Users/brad/.rvm/gems/ruby-1.9.3-p194/gems/mysql2-0.3.11/ext/mysql2/gem_make.out
An error occured while installing mysql2 (0.3.11), and Bundler cannot continue.
Make sure that `gem install mysql2 -v '0.3.11'` succeeds before bundling.
所以网上到处都说要下载mysql吧?我得到自制软件并运行brew install mysql
据我所知,这是成功的。我有路径和文件夹和东西,但我没有mysql_config文件。无处不在。安装失败了吗?我需要做什么才能获得该文件?再一次,我在Mac上,所以我不能apt-get install
任何开发文件,这似乎可以帮助很多人。我很困惑。任何帮助都会很棒。
答案 0 :(得分:1)
重新编译Ruby修复了这个问题。推荐到iltempo。 Idk如何赞成评论...
答案 1 :(得分:0)
您可以xcode-select --install
安装命令行工具,之后,一切都应该正常工作