命令行gem安装错误 - sqlite3 - Rails新命令

时间:2014-11-19 11:12:49

标签: ruby-on-rails ruby command-line sqlite rubygems

我尝试在命令行中创建一个新的rails应用程序并出现以下错误。问题是什么?

我自己尝试过,但我对编码很新,甚至通过它阅读我完全迷失了!

 /Users/johnsway/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
    checking for sqlite3.h... *** 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
    --without-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/johnsway/.rvm/rubies/ruby-2.1.2/bin/ruby
    --with-sqlite3-dir
    --without-sqlite3-dir
    --with-sqlite3-include
    --without-sqlite3-include=${sqlite3-dir}/include
    --with-sqlite3-lib
    --without-sqlite3-lib=${sqlite3-dir}/lib
/Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:456:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1120:in `block in find_header'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
    from /Users/johnsway/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1119:in `find_header'
    from extconf.rb:30:in `<main>'

extconf failed, exit code 1

如果您还有其他需求,请随时询问!

感谢您的帮助!

1 个答案:

答案 0 :(得分:1)

也许这个问题与最近的XCode更新有关。更新XCode后,您需要执行以下步骤:

  1. 打开Xcode并接受许可协议
  2. 重新安装命令行工具。
  3. 第二步似乎取决于您的操作系统版本。如果xcode-select --install不起作用,请尝试在Install Command Line Developer Tools中启动/System/Library/CoreServices应用。

    重新安装命令行工具后,尝试重新运行bundle install