got an error while trying to install devise gem. Added gem "devise", "~> 3.2.2" to my Gemlist and went into terminal to do the following:
Steven-Lims-MacBook-Pro:Pinteresting stevenlim$ bundle install
Fetching gem metadata from https://rubygems.org/..........
Fetching additional metadata from https://rubygems.org/..
Resolving dependencies...
Using rake (10.1.1)
Using i18n (0.6.9)
Using minitest (4.7.5)
Using multi_json (1.8.4)
Using atomic (1.1.14)
Using thread_safe (0.1.3)
Using tzinfo (0.3.38)
Using activesupport (4.0.2)
Using builder (3.1.4)
Using erubis (2.7.0)
Using rack (1.5.2)
Using rack-test (0.6.2)
Using actionpack (4.0.2)
Using mime-types (1.25.1)
Using polyglot (0.3.3)
Using treetop (1.4.15)
Using mail (2.5.4)
Using actionmailer (4.0.2)
Using activemodel (4.0.2)
Using activerecord-deprecated_finders (1.0.3)
Using arel (4.0.1)
Using activerecord (4.0.2)
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby extconf.rb
checking for ruby/util.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=/usr/local/rvm/rubies/ruby-2.0.0-p353/bin/ruby
/usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:565:in `try_cpp'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from /usr/local/rvm/rubies/ruby-2.0.0-p353/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
from extconf.rb:14:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-2.0.0-p353/gems/bcrypt-ruby-3.1.2 for inspection.
Results logged to /usr/local/rvm/gems/ruby-2.0.0-p353/extensions/x86_64-darwin-10/2.0.0/bcrypt-ruby-3.1.2/gem_make.out
An error occurred while installing bcrypt-ruby (3.1.2), and Bundler cannot
continue.
Make sure that `gem install bcrypt-ruby -v '3.1.2'` succeeds before bundling.
Am new to programming and Ruby on Rails so kindly assist. Thanks!
managed to solve this. I had upgraded to OS Mavericks recently and problem came up.
Have tried gem install bcrypt-ruby -v '3.1.2' in terminal but encountered same problem.
Thereafter, went to install Xcode on App Store as running Xcode-select --install in terminal failed as well (program can't be found).
Thus I chanced upon this thread and followed advice to run sudo ln -s /usr/bin/llvm-gcc /usr/bin/gcc-4.2 in terminal.
Thread: gem install pg doesn't work on OSX Lion
Thereafter I ran gem install bcrypt-ruby -v '3.1.2' and bundle install in terminal and all good for now. Hope this works. Actually I don't know what I am doing but hopefully it works. Can someone enlighten me what I am actually doing?
Ran into this issue after updating OS X Mavericks to 10.9.5 which also updates Xcode (Version 6.0.1 (6A317)).
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/e/.rvm/rubies/ruby-2.1.1/bin/ruby extconf.rb
creating Makefile
Compiling v8 for x64
Using python 2.7.5
Unable to find a compiler officially supported by v8.
It is recommended to use GCC v4.4 or higher
Using compiler: /usr/bin/c++ (c++ version )
extconf failed, exit code 1
Gem files will remain installed in /Users/e/.rvm/gems/ruby-2.1.1/gems/libv8-3.16.14.7 for inspection.
Results logged to /Users/e/.rvm/gems/ruby-2.1.1/extensions/x86_64-darwin-12/2.1.0-static/libv8-3.16.14.7/gem_make.out
An error occurred while installing libv8 (3.16.14.7), and Bundler cannot continue.
Make sure that `gem install libv8 -v '3.16.14.7'` succeeds before bundling.
To resolve: Must accept and finalise install of Xcode in order for bundle update to complete.
After finalising install of Xcode, bundle update completed without issue.
Related
OS: Mac Mojave 10.14.6
Rails 5.2.3
Ruby 2.6.3
I generated a new application, and was trying to do a
bundle install
Which was interrupted with the following error message:
Fetching nio4r 2.5.2
Installing nio4r 2.5.2 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
current directory: /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/nio4r-2.5.2/ext/nio4r
/Users/johndoe/.rbenv/versions/2.6.3/bin/ruby -I /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0 -r ./siteconf20190924-11373-sf54p6.rb extconf.rb --with-cflags\=-std\=c99
checking for unistd.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/johndoe/.rbenv/versions/2.6.3/bin/$(RUBY_BASE_NAME)
/Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:467:in `try_do': The compiler failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:601:in `try_cpp'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:1109:in `block in have_header'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:959:in `block in checking_for'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:361:in `block (2 levels) in postpone'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:361:in `block in postpone'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:331:in `open'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:357:in `postpone'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:958:in `checking_for'
from /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/2.6.0/mkmf.rb:1108:in `have_header'
from extconf.rb:14:in `<main>'
To see why this extension failed to compile, please check the mkmf.log which can be found here:
/Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/nio4r-2.5.2/mkmf.log
extconf failed, exit code 1
Gem files will remain installed in /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/gems/nio4r-2.5.2 for inspection.
Results logged to /Users/johndoe/.rbenv/versions/2.6.3/lib/ruby/gems/2.6.0/extensions/x86_64-darwin-18/2.6.0-static/nio4r-2.5.2/gem_make.out
An error occurred while installing nio4r (2.5.2), and Bundler cannot continue.
Make sure that `gem install nio4r -v '2.5.2' --source 'https://rubygems.org/'` succeeds before bundling.
In Gemfile:
rails was resolved to 5.2.3, which depends on
actioncable was resolved to 5.2.3, which depends on
nio4r
I looked around, and tried some of the suggestions, such as
bundle config build.nio4r --with-cflags="-std=c99"
bundle
But it did not work. Any ideas?
EDIT:
This had been working fine, with my existing project, but it noticed that it stopped working yesterday, when I did a:
bundle update
I got the same error. If I do:
bundle install
when I add a new Gem to my existing project, it works fine. In my Gemfile.lock file, I have:
actioncable (5.2.3)
actionpack (= 5.2.3)
nio4r (~> 2.0)
websocket-driver (>= 0.6.1)
and:
nio4r (2.5.1)
By looking at it, it looks like you are missing tools to compile the gems. I'm not a OS-X user, but in linux distros this would be solved by installing the package build-essentials.
I did a quick research online and found out that in OS-X this tools are packaged in xcode, so I would recommend that you tried this command: xcode-select --install
Keep me posted if this fixed your issue.
Run xcode-select --install solved the issue. Thanks #luiz
when making a new ruby on rails app via my terminal, by the command "rails new newapp" I find the following error message in my terminal. It seems linked difficulties with installing bye bug 9.0.5. After a while the terminal says it can not succeed before bundling. I suppose this a major barrier to the correct development of my app. Can anyone help?
I am attaching the relevant terminal statements and highlight in bold what I think where the problem is.
Fetching gem metadata from https://rubygems.org/
Fetching version metadata from https://rubygems.org/
Fetching dependency metadata from https://rubygems.org/
Resolving dependencies......
Using rake 11.2.2
Using i18n 0.7.0
Using json 1.8.3
Using minitest 5.9.0
Using thread_safe 0.3.5
Using builder 3.2.2
Using erubis 2.7.0
Using mini_portile2 2.1.0
Using pkg-config 1.1.7
Using rack 1.6.4
Using mime-types-data 3.2016.0521
Using arel 6.0.3
Using debug_inspector 0.0.2
Using bundler 1.12.5
Installing byebug 9.0.5 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/nicholaswenzel/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160710-36604-3ys7vr.rb extconf.rb
creating Makefile
make "DESTDIR=" clean
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
make "DESTDIR="
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
make failed, exit code 1
Gem files will remain installed in /Users/nicholaswenzel/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/byebug-9.0.5 for inspection.
Results logged to /Users/nicholaswenzel/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/byebug-9.0.5/gem_make.out
Using coffee-script-source 1.10.0
Using execjs 2.7.0
Using thor 0.19.1
Using concurrent-ruby 1.0.2
Using multi_json 1.12.1
Using sass 3.4.22
Using tilt 2.0.5
Using spring 1.7.2
Using sqlite3 1.3.11
Using turbolinks-source 5.0.0
Using rdoc 4.2.2
Using tzinfo 1.2.2
Installing nokogiri 1.6.8 with native extensions
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/nicholaswenzel/.rbenv/versions/2.2.3/bin/ruby -r ./siteconf20160710-36604-1ukclqg.rb extconf.rb
Using pkg-config version 1.1.7
checking if the C compiler accepts ... *** 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/nicholaswenzel/.rbenv/versions/2.2.3/bin/$(RUBY_BASE_NAME)
--help
--clean
/Users/nicholaswenzel/.rbenv/versions/2.2.3/lib/ruby/2.2.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/nicholaswenzel/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `block in try_compile'
from /Users/nicholaswenzel/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:522:in `with_werror'
from /Users/nicholaswenzel/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:571:in `try_compile'
from extconf.rb:138:in `nokogiri_try_compile'
from extconf.rb:162:in `block in add_cflags'
from /Users/nicholaswenzel/.rbenv/versions/2.2.3/lib/ruby/2.2.0/mkmf.rb:619:in `with_cflags'
from extconf.rb:161:in `add_cflags'
from extconf.rb:414:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/nicholaswenzel/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/gems/nokogiri-1.6.8 for inspection.
Results logged to /Users/nicholaswenzel/.rbenv/versions/2.2.3/lib/ruby/gems/2.2.0/extensions/x86_64-darwin-15/2.2.0-static/nokogiri-1.6.8/gem_make.out
Using rack-test 0.6.3
Using mime-types 3.1
Using binding_of_caller 0.7.2
An error occurred while installing byebug (9.0.5), and Bundler cannot continue.
Make sure that `gem install byebug -v '9.0.5'` succeeds before bundling.
run bundle exec spring binstub --all
* bin/rake: spring inserted
* bin/rails: spring inserted
Nicholass-MacBook-Pro:installmaster nicholaswenzel$
Try,
xcode-select --install
Hope this helps.
My near term goal is to continue running some tutorials from RailsApp. I had previously had no issues running rails and writing apps and doing some older tutorials. A new one came out that used a template file for thee startup app. I needed to upgrade my ruby & rails versions for this, but it still would not work (question here: Error with RailsApps starter app for rails-devise-roles tutorial) so I went ahead and upgraded mavericks.
My question is how can I get the rails to create a new app and run ? i can't develop anything now. I don't know how ot revert to older versions of ruby (maybe one that does not use sqlite3?) [<
I have googled & stack overflow searched similar problems and none of the solutions seem to work for me so far.
Basic info:
$which ruby
/Users/suzanne/.rvm/rubies/ruby-2.1.2/bin/ruby
$ruby -v
ruby 2.1.2p95 (2014-05-08 revision 45877) [x86_64-darwin13.0]
$ xcode-select --print-path
/Applications/Xcode.app/Contents/Developer
I have also opened XCode, updated libraries requested after opening. Version listed on splash page is Version 5.1.1 (5B1008)
Now I have done the following steps to test rails and get a basic new app working
mkdir myapp
cd myapp
rvm use ruby-2.1.2#myapp --ruby-version --create
gem install rails
rails new .
and at this point I get this error:
Could not find gem 'sqlite3 (>= 0) ruby' in the gems available on this machine.
XCode is installed, gcc is installed, sqlite3 is installed.
$ whereis sqlite3
/usr/bin/sqlite3
$bundle install
Fetching gem metadata from https://rubygems.org/..........
Resolving dependencies...
Using rake 10.3.2
Using i18n 0.6.11
Using json 1.8.1
Using minitest 5.4.1
Using thread_safe 0.3.4
Using tzinfo 1.2.2
Using activesupport 4.1.5
Using builder 3.2.2
Using erubis 2.7.0
Using actionview 4.1.5
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.1.5
Using mime-types 1.25.1
Using polyglot 0.3.5
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.1.5
Using activemodel 4.1.5
Using arel 5.0.1.20140414130214
Using activerecord 4.1.5
Using bundler 1.7.2
Using coffee-script-source 1.8.0
Using execjs 2.2.1
Using coffee-script 2.3.0
Using thor 0.19.1
Using railties 4.1.5
Using coffee-rails 4.0.1
Using hike 1.2.3
Using multi_json 1.10.1
Using jbuilder 2.1.3
Using jquery-rails 3.1.2
Using tilt 1.4.1
Using sprockets 2.11.0
Using sprockets-rails 2.1.4
Using rails 4.1.5
Using rdoc 4.1.1
Using sass 3.2.19
Using sass-rails 4.0.3
Using sdoc 0.4.1
Using spring 1.1.3
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/suzanne/.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/suzanne/.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
--enable-local
--disable-local
/Users/suzanne/.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/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1120:in `block in find_header'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1119:in `find_header'
from extconf.rb:35:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/suzanne/.rvm/gems/ruby-2.1.2#myapp/gems/sqlite3-1.3.9 for inspection.
Results logged to /Users/suzanne/.rvm/gems/ruby-2.1.2#myapp/extensions/x86_64-darwin-13/2.1.0-static/sqlite3-1.3.9/gem_make.out
An error occurred while installing sqlite3 (1.3.9), and Bundler cannot continue.
Make sure that `gem install sqlite3 -v '1.3.9'` succeeds before bundling.
$ gem install sqlite3 -v '1.3.9'
Building native extensions. This could take a while...
ERROR: Error installing sqlite3:
ERROR: Failed to build gem native extension.
/Users/suzanne/.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/suzanne/.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
--enable-local
--disable-local
/Users/suzanne/.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/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:587:in `try_cpp'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1120:in `block in find_header'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:918:in `block in checking_for'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:351:in `block in postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:321:in `open'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:347:in `postpone'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:917:in `checking_for'
from /Users/suzanne/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/mkmf.rb:1119:in `find_header'
from extconf.rb:35:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/suzanne/.rvm/gems/ruby-2.1.2#myapp/gems/sqlite3-1.3.9 for inspection.
Results logged to /Users/suzanne/.rvm/gems/ruby-2.1.2#myapp/extensions/x86_64-darwin-13/2.1.0-static/sqlite3-1.3.9/gem_make.out
There was a change in Mavericks that means you have to install the command line tools.
Type in a terminal window
xcode-select --install
You should then be prompted to install the command line tools
Once that is done, you should be able to build your gems
Try gem install sqlite3 -- --with-sqlite3-dir=/opt/local and then run bundle install again.
If that doesn't work, I think you just need to install sqlite3. If you have Homebrew, this should work:
brew install sqlite3
Had the same problem running Rails 4.1.5 on CentOS 6.5.
I fixed it by:
Installing the sqlite dev library (On CentOS it's $ yum install -y sqlite-devel); and
Installing the sqlite3 gem with gem install sqlite3.
I was able to create a new rails project afterward.
I am running Rails v4.0.2 on Mac OS 10.9.2 and I had everything smoothly. All of a sudden I'm getting an error saying gems are missing when I try rails server. I run bundle install and this is the output:
Fetching gem metadata from https://rubygems.org/.......
Fetching additional metadata from https://rubygems.org/..
Using rake 10.1.1
Using i18n 0.6.9
Using minitest 4.7.5
Using multi_json 1.9.0
Using atomic 1.1.16
Using thread_safe 0.2.0
Using tzinfo 0.3.39
Using activesupport 4.0.2
Using builder 3.1.4
Using erubis 2.7.0
Using rack 1.5.2
Using rack-test 0.6.2
Using actionpack 4.0.2
Using mime-types 1.25.1
Using polyglot 0.3.4
Using treetop 1.4.15
Using mail 2.5.4
Using actionmailer 4.0.2
Using activemodel 4.0.2
Using activerecord-deprecated_finders 1.0.3
Using arel 4.0.2
Using activerecord 4.0.2
Using encryptor 1.3.0
Using attr_encrypted 1.3.2
Using awesome_print 1.2.0
Using bcrypt 3.1.7
Using bcrypt-ruby 3.1.5
Using net-ssh 2.8.0
Using net-scp 1.1.2
Using tins 1.0.0
Using term-ansicolor 1.3.0
Using sshkit 1.3.0
Using capistrano 3.1.0
Using capistrano-bundler 1.1.2
Using capistrano-rails 1.1.1
Using climate_control 0.0.3
Using cocaine 0.5.3
Using coderay 1.1.0
Using coffee-script-source 1.7.0
Using execjs 2.0.2
Using coffee-script 2.2.0
Using thor 0.18.1
Using railties 4.0.2
Using coffee-rails 4.0.1
Using columnize 0.3.6
Using currencies 0.4.2
Using countries 0.9.3
Using debugger-linecache 1.2.0
Using debugger-ruby_core_source 1.3.2
Gem::Ext::BuildError: ERROR: Failed to build gem native extension.
/Users/aaronpardes/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
*** 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/aaronpardes/.rvm/rubies/ruby-2.1.2/bin/ruby
/Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `stat': No such file or directory # rb_file_s_stat - ./212/ruby_debug.h (Errno::ENOENT)
from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `block in fu_each_src_dest'
from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1587:in `fu_each_src_dest0'
from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1571:in `fu_each_src_dest'
from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:399:in `cp'
from extconf.rb:83:in `block in <main>'
from extconf.rb:82:in `each'
from extconf.rb:82:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/aaronpardes/.rvm/gems/ruby-2.1.2#ocx/gems/debugger-1.6.6 for inspection.
Results logged to /Users/aaronpardes/.rvm/gems/ruby-2.1.2#ocx/extensions/x86_64-darwin-13/2.1.0-static/debugger-1.6.6/gem_make.out
An error occurred while installing debugger (1.6.6), and Bundler cannot continue.
Make sure that `gem install debugger -v '1.6.6'` succeeds before bundling.
When I try to run gem install debugger -v '1.6.6' I get the following output:
Building native extensions. This could take a while...
ERROR: Error installing debugger:
ERROR: Failed to build gem native extension.
/Users/aaronpardes/.rvm/rubies/ruby-2.1.2/bin/ruby extconf.rb
*** 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/aaronpardes/.rvm/rubies/ruby-2.1.2/bin/ruby
/Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `stat': No such file or directory # rb_file_s_stat - ./212/ruby_debug.h (Errno::ENOENT)
from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1573:in `block in fu_each_src_dest'
from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1587:in `fu_each_src_dest0'
from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:1571:in `fu_each_src_dest'
from /Users/aaronpardes/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/fileutils.rb:399:in `cp'
from extconf.rb:83:in `block in <main>'
from extconf.rb:82:in `each'
from extconf.rb:82:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Users/aaronpardes/.rvm/gems/ruby-2.1.2#ocx/gems/debugger-1.6.6 for inspection.
Results logged to /Users/aaronpardes/.rvm/gems/ruby-2.1.2#ocx/extensions/x86_64-darwin-13/2.1.0-static/debugger-1.6.6/gem_make.out
I am very confused why this error came up all of a sudden. I have been up and running without issue for weeks. I've tried creating a new gemset with rvm and still encounter the same issue. After searching around I found recommendations to update dependencies first and then try bundle install but this did not solve the issue.
Ruby 2.1.2 isn't supported by debugger, unfortunately. Instead, use the byebug gem. See this discussion for more details.
Ruby 2.x is not supported by the debugger gem and you should use byebug instead. Once Rails 4.2.0 is released (or if you use the Rails 4.2.0rc versions) byebug will be the default debugger included in your Gemfile, but if you're on an earlier version of Rails then you'll need to make the change manually in your Gemfile.
Just replace
gem "debugger"
with
gem "byebug"
in your Gemfile and run a bundle install.
Some more background
Even the maintainer of the debugger gem makes this recommendation. The debugger gem's README on GitHub has the following note:
Only 1.9.2 and 1.9.3 are supported. For 2.X rubies, consider using byebug.
The maintainer has no intention of fixing this; he closed the issue debugger can't be installed on ruby 2.X unfixed, explaining that debugger never properly supported Ruby 2.X and that he now recommends byebug.
Additionally, the maintainer of debugger has not pushed a commit or even replied to a pull request since June 2014. The gem seems to be abandonware at this point.
Rails itself has adopted byebug as the official debugger for Ruby 2.X as of this pull request in April, and from Rails 4.2.0 onwards the Gemfile created when you run rails new my_new_app_name will reference byebug instead of debugger for Ruby 2.X users.
tl;dr
debugger is dead. Use byebug.
This monstrosity of a command ended up doing the trick for me:
gem install debugger-ruby_core_source && ARCHFLAGS="-I$(dirname -- "$(gem which debugger/ruby_core_source/ruby-$(ruby -v | awk '{sub(/p/, "-p", $2); print $2}')/vm_core.h)") -include vm_core.h" bundle install
My apologies.
Breaking it down:
First, install the Ruby headers.
gem install debugger-ruby_core_source
Now, if that succeeds we want to run bundle install but it needs to be able to find those Ruby headers. Grepping the output of gem contents debugger-rebuy_core_source, we find that it installs a bunch of different headers for different patchlevels of Ruby:
$ gem contents debugger-ruby_core_source | grep vm_core.h
/Users/andrew/.gem/ruby/2.0.0/gems/debugger-ruby_core_source-1.3.2/lib/debugger/ruby_core_source/ruby-1.9.2-p290/vm_core.h
/Users/andrew/.gem/ruby/2.0.0/gems/debugger-ruby_core_source-1.3.2/lib/debugger/ruby_core_source/ruby-1.9.2-p318/vm_core.h
/Users/andrew/.gem/ruby/2.0.0/gems/debugger-ruby_core_source-1.3.2/lib/debugger/ruby_core_source/ruby-1.9.2-p320/vm_core.h
...
What’s the current patch level?
$ ruby -v
ruby 2.0.0p481 (2014-05-08 revision 45883) [universal.x86_64-darwin14]
To transform that into the ruby-2.0.0-p318 format used by the debugger-ruby_core_source gem, we use awk to print only the second field of that version string, and change the p to -p:
$ ruby -v | awk '{sub(/p/, "-p", $2); print $2}'
2.0.0-p481
Now we run bundle install, with ARCHFLAGS set to add the directory containing the ruby headers to the include file search path, and preload vm_core.h:
gem install debugger-ruby_core_source \
&& ARCHFLAGS="-I$(dirname -- \
"$(gem which debugger/ruby_core_source/ruby-$(ruby -v | awk '{sub(/p/, "-p", $2); print $2}')/vm_core.h)") \
-include vm_core.h" \
bundle install
i.e.,
gem install debugger-ruby_core_source \
&& ARCHFLAGS="-I<path-to-dir_containing_vm_core.h> -include vm_core.h" \
bundle install
For those who's using gem 'pry-debugger' just change it to gem 'pry-byebug' in your Gemfile.
Unfortunatelly no answer solved this problem. As answered before by nickh, "Ruby 2.1.2 isn't supported by debugger".
I found a japanese post that allowed me to install this gem, but i don't take any responsibility for it, since it's not an official release. Do it at your own risk:
git clone https://github.com/mekishizufu/debugger.git
cd debugger
git checkout ca451a9bdf
gem build debugger.gemspec
gem install debugger-1.6.6.gem
Source: http://d.hatena.ne.jp/mabots/20140723/1406087504
**Step 1**
gilchristiano#rails-intro:~/workspace (master) $ rails --version
Could not find debugger-1.6.6 in any of the sources
Run `bundle install` to install missing gems.
**Step 2**
gilchristiano#rails-intro:~/workspace (master) $ debugger-1.6.6
bash: debugger-1.6.6: command not found
**Step 3**
gilchristiano#rails-intro:~/workspace (master) $ gem install debugger -v '1.6.6'
Building native extensions. This could take a while...
Successfully installed debugger-1.6.6
1 gem installed
**Step 4**
gilchristiano#rails-intro:~/workspace (master) $ bundle install
I am on osx 10.6.7 trying to run bundle install on a new rails 3.0.7 app and it keeps failing when trying to build the pg gem. It keeps telling me that I have need the developer tools. But as far as I can tell I have the developer tools installed.
Here is the output of xcodebuild -version
Xcode 3.2.6
Component versions: DevToolsCore-1809.0; DevToolsSupport-1806.0
BuildVersion: 10M2518
Here is the output of the failed pg gem build
/Users/bm/.rvm/rubies/ruby-1.9.2-head/bin/ruby extconf.rb --with-pg-config=/Library/PostgreSQL/8.4/bin/pg_config
Using config values from /Library/PostgreSQL/8.4/bin/pg_config
checking for libpq-fe.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/bm/.rvm/rubies/ruby-1.9.2-head/bin/ruby
--with-pg
--without-pg
--with-pg-dir
--without-pg-dir
--with-pg-include
--without-pg-include=${pg-dir}/include
--with-pg-lib
--without-pg-lib=${pg-dir}/lib
--with-pg-config
/Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:368:in `try_do': The complier failed to generate an executable file. (RuntimeError)
You have to install development tools first.
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:853:in `block in find_header'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/mkmf.rb:852:in `find_header'
from extconf.rb:31:in `<main>'
Gem files will remain installed in /Users/bm/.rvm/gems/ruby-1.9.2-head#rc_search/gems/pg-0.11.0 for inspection.
Results logged to /Users/bm/.rvm/gems/ruby-1.9.2-head#rc_search/gems/pg-0.11.0/ext/gem_make.out
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rubygems/installer.rb:486:in `block in build_extensions'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rubygems/installer.rb:446:in `each'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rubygems/installer.rb:446:in `build_extensions'
from /Users/bm/.rvm/rubies/ruby-1.9.2-head/lib/ruby/1.9.1/rubygems/installer.rb:198:in `install'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/source.rb:100:in `install'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/installer.rb:55:in `block in run'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `block in each'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/spec_set.rb:12:in `each'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/installer.rb:44:in `run'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/installer.rb:8:in `install'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/cli.rb:217:in `install'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/vendor/thor/task.rb:22:in `run'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/vendor/thor/invocation.rb:118:in `invoke_task'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/vendor/thor.rb:246:in `dispatch'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/lib/bundler/vendor/thor/base.rb:389:in `start'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/gems/bundler-1.0.0/bin/bundle:13:in `<top (required)>'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/bin/bundle:19:in `load'
from /Users/bm/.rvm/gems/ruby-1.9.2-head#global/bin/bundle:19:in `<main>'
Any help would be immensely appreciated. FYI I also tried building the app with a mysql and essentially got the same stack. So I'm pretty sure I'm missing some sort of developer build tools, but I just don't know which ones. :(
I had the exact same problem when running bundle install in a Rails app. I installed homebrew and then ran
brew install postgresql.
That finally installed postgres correctly and the issue was fixed for me.
export ARCHFLAGS='-arch x86_64'
export PATH=/Library/PostgreSQL/9.1/bin:${PATH}
gem install pg
If you are using the PostgreSQL app on osx, you may need to change path the following (as the location of the binaries and config files changes) instead of the path shown in lesyk's answer:
export PATH=/Applications/Postgres.app/Contents/MacOS/bin:${PATH}
What worked for me was Zag Zag's comment:
~/projects/foo$ env ARCHFLAGS="-arch x86_64" gem install pg
Building native extensions. This could take a while...
Successfully installed pg-0.11.0
1 gem installed
Building YARD (yri) index for pg-0.11.0...
~/projects/foo$ bundle
...
Using pg (0.11.0)
...
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
I had the same issue. For me the fix was:
sudo ln -s gcc /usr/bin/gcc-4.2
I also ran into this issue, for me the answer was updating RVM of all things.
rvm get head
rvm install 1.9.2
I'm on the same OSX and XCode version as you are: bundle install with pg 0.11.0 works fine to me.
However, I found this article that might be able to help you
fixing-the-you-have-to-install-development-tools-first-error-with-nokogiri
If you're using rvm, you can try:
rvm update head
rvm --force install
1.9.2 gem install bundle
Here my stack:
[ 08:36:26 ] > bundle install
Fetching source index for http://rubygems.org/
Enter your password to install the bundled RubyGems to your system:
Using rake (0.8.7)
Using abstract (1.0.0)
Installing activesupport (3.0.7)
Installing builder (2.1.2)
Installing i18n (0.5.0)
Installing activemodel (3.0.7)
Using erubis (2.6.6)
Using rack (1.2.2)
Installing rack-mount (0.6.14)
Installing rack-test (0.5.7)
Installing tzinfo (0.3.27)
Installing actionpack (3.0.7)
Using mime-types (1.16)
Installing polyglot (0.3.1)
Installing treetop (1.4.9)
Installing mail (2.2.19)
Installing actionmailer (3.0.7)
Installing arel (2.0.9)
Installing activerecord (3.0.7)
Installing activeresource (3.0.7)
Using bundler (1.0.10)
Installing pg (0.11.0) with native extensions
Using thor (0.14.6)
Installing railties (3.0.7)
Installing rails (3.0.7)
Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed.
[ ronda#MacBook ~/Projects/rails_projects/first_app ]
[ 08:42:57 ] > rails server
=> Booting WEBrick
=> Rails 3.0.7 application starting in development on http://0.0.0.0:3000
=> Call with -d to detach
=> Ctrl-C to shutdown server
[2011-04-27 20:45:27] INFO WEBrick 1.3.1
[2011-04-27 20:45:27] INFO ruby 1.9.2 (2011-02-18) [x86_64-darwin10]
[2011-04-27 20:45:27] INFO WEBrick::HTTPServer#start: pid=4757 port=3000
The simple solution:
run brew install postgresql
install the gem with sudo permissions: like so:
sudo gem install pg -v '0.17.1'
I was stuck on my bundle install for 3 days. Tried Everything like adding env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config
I was able to see pg gem getting installed after this command but still it was not installing from bundle install, which was a pain because I dint know what to write in Gemfile except gem 'pg'
The thing which finally worked for me was to find that my pg_config was in /Library/PostgreSQL/9.3/bin/pg_config and by default the Gemfile bundle install looks in /usr/local/bin/pg_config
I just ran the following command and magic happened. bundle config build.pg --with-pg-config=/Library/PostgreSQL/9.3/bin/pg_config
Some correction. For those who have installed postgres using homebrew.
1) write the following line in your ~/.bash_profile
export ARCHFLAGS="-arch x86_64"
2) restart console
3) execute following command
bundle config build.pg --with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config (this has to be your pg config address, can differ for each depending on versions of postgres)
4) Install pg once locally by running this command
sudo env ARCHFLAGS="-arch x86_64" gem install pg -- --with-pg-config=/usr/local/Cellar/postgresql/9.3.5_1/bin/pg_config
5) bundle install