Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialalborz
Full Stack JavaScript Techdegree Graduate 30,885 PointsI'm getting an error when typing "rails new testapp" -- cannot create app
Hi!
So I just reinstalled my Mac and restored most of my older stuff back onto my machine.
Anyway, when I type rails new testapp
I get the following:
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/alborz/.rvm/rubies/ruby-2.1.4/bin/ruby -r ./siteconf20141214-94508-wf5b6t.rb 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/alborz/.rvm/rubies/ruby-2.1.4/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/alborz/.rvm/rubies/ruby-2.1.4/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/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:1120:in `block in find_header'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:1119:in `find_header'
from extconf.rb:30:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/alborz/.rvm/gems/ruby-2.1.4/gems/sqlite3-1.3.10 for inspection.
Results logged to /Users/alborz/.rvm/gems/ruby-2.1.4/extensions/x86_64-darwin-13/2.1.0-static/sqlite3-1.3.10/gem_make.out
An error occurred while installing sqlite3 (1.3.10), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.10'` succeeds before bundling.
run bundle exec spring binstub --all
/Users/alborz/.rvm/gems/ruby-2.1.4/gems/bundler-1.7.9/lib/bundler/resolver.rb:368:in `resolve': Could not find gem 'sqlite3 (>= 0) ruby' in the gems available on this machine. (Bundler::GemNotFound)
from /Users/alborz/.rvm/gems/ruby-2.1.4/gems/bundler-1.7.9/lib/bundler/resolver.rb:166:in `start'
from /Users/alborz/.rvm/gems/ruby-2.1.4/gems/bundler-1.7.9/lib/bundler/resolver.rb:129:in `resolve'
from /Users/alborz/.rvm/gems/ruby-2.1.4/gems/bundler-1.7.9/lib/bundler/definition.rb:193:in `resolve'
from /Users/alborz/.rvm/gems/ruby-2.1.4/gems/bundler-1.7.9/lib/bundler/definition.rb:132:in `specs'
from /Users/alborz/.rvm/gems/ruby-2.1.4/gems/bundler-1.7.9/lib/bundler/definition.rb:177:in `specs_for'
from /Users/alborz/.rvm/gems/ruby-2.1.4/gems/bundler-1.7.9/lib/bundler/definition.rb:166:in `requested_specs'
from /Users/alborz/.rvm/gems/ruby-2.1.4/gems/bundler-1.7.9/lib/bundler/environment.rb:18:in `requested_specs'
from /Users/alborz/.rvm/gems/ruby-2.1.4/gems/bundler-1.7.9/lib/bundler/runtime.rb:13:in `setup'
from /Users/alborz/.rvm/gems/ruby-2.1.4/gems/bundler-1.7.9/lib/bundler.rb:122:in `setup'
from /Users/alborz/.rvm/gems/ruby-2.1.4/gems/bundler-1.7.9/lib/bundler/setup.rb:17:in `<top (required)>'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:54:in `require'
I wasn't able to do a gem install sqlite3
, so I did brew install sqlite3
When I try to do gem install sqlite3 -v '1.3.10
I get the following:
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/Users/alborz/.rvm/rubies/ruby-2.1.4/bin/ruby -r ./siteconf20141214-94534-zh0i03.rb 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/alborz/.rvm/rubies/ruby-2.1.4/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/alborz/.rvm/rubies/ruby-2.1.4/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/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:1120:in `block in find_header'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /Users/alborz/.rvm/rubies/ruby-2.1.4/lib/ruby/2.1.0/mkmf.rb:1119:in `find_header'
from extconf.rb:30:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/alborz/.rvm/gems/ruby-2.1.4/gems/sqlite3-1.3.10 for inspection.
Results logged to /Users/alborz/.rvm/gems/ruby-2.1.4/extensions/x86_64-darwin-13/2.1.0-static/sqlite3-1.3.10/gem_make.out
Thanks in advance!!
1 Answer
Joshua Shroy
9,943 PointsLooks like an issue with sqlite.
First check if you have sqlite gem by running gem list
. If it's not installed, install it with gem install sqlite3 -- --with-sqlite3-dir=/opt/local
If that doesn't work try running xcode-select --install
, then running rails.
alborz
Full Stack JavaScript Techdegree Graduate 30,885 Pointsalborz
Full Stack JavaScript Techdegree Graduate 30,885 PointsUnfortunately after installing xcode I tried installing sqlite but that didn't work again, and
rails new testapp
didn't even create ANY files this time... I get:Joshua Shroy
9,943 PointsJoshua Shroy
9,943 PointsI recently switched to mac and had a similar issue so I'm determined to help you through this :).
Are you running the latest OSX? Also, what do you get when running
which -a ruby
andruby -v
?alborz
Full Stack JavaScript Techdegree Graduate 30,885 Pointsalborz
Full Stack JavaScript Techdegree Graduate 30,885 PointsThank you. :)
I am actually running OS X Mavericks 10.9.5 -- I reinstalled this OS today.
Here's what I get when I run the commands
which -a ruby
:And when I run
ruby -v
:ruby 2.1.1p76 (2014-02-24 revision 45161) [x86_64-darwin12.0]
UPDATE:
For some reason now the output has changed.
When I run
which -a ruby
I get:And when I run
ruby -v
I get:ruby 2.1.4p265 (2014-10-27 revision 48166) [x86_64-darwin13.0]
Joshua Shroy
9,943 PointsJoshua Shroy
9,943 PointsWith the original error, it shows
.rvm
as part of the directory and yet your recent output shows.rbenv
. Unfortunately, ruby can only run one Version Manager. Try uninstalling the one you don't want and try again.alborz
Full Stack JavaScript Techdegree Graduate 30,885 Pointsalborz
Full Stack JavaScript Techdegree Graduate 30,885 PointsAlright that did the trick! Thank you!!
Joshua Shroy
9,943 PointsJoshua Shroy
9,943 PointsGreat! Glad that worked!