简体   繁体   中英

Command line gem install error - sqlite3 - Rails New Command

I tried creating a new rails application in command line and had the following error. What's the problem?

I have tried working it out myself, but I'm new to coding and even reading through it I'm completely lost!

 /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

If you need anything else, please feel free to ask!

Thank you for your help!

Perhaps this problem has to do with a recent update of XCode. After a XCode update you need to do the following steps:

  1. Open Xcode and accept the license agreement
  2. Reinstall the Command Line Tools.

The second step seems to depend on your OS versions. If xcode-select --install does not work try to start the Install Command Line Developer Tools app in /System/Library/CoreServices .

After reinstalling the Command Line Tools try to rerun bundle install .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM