Command line gem install error - sqlite3 - Rails New Command - ruby-on-rails

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:
Open Xcode and accept the license agreement
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.

Related

rails gem unf_ext will not install when bundling with stripe

Stack/ Tech specs:
ruby 2.2.2
rails 4.2.3
Using OS X 10.11
I am attempting to install stripe in my rails app. Added gem 'stripe' to my Gemfile, ran bundle install, and received this error message:
/Users/me/.rbenv/versions/2.2.2/bin/ruby -r ./siteconf20151006-77029-11oqg9a.rb extconf.rb
checking for main() in -lstdc++... *** 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/t/.rbenv/versions/2.2.2/bin/$(RUBY_BASE_NAME)
--with-static-libstdc++
--without-static-libstdc++
--with-stdc++lib
--without-stdc++lib
/Users/t/.rbenv/versions/2.2.2/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/t/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:541:in `try_link0'
from /Users/t/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:556:in `try_link'
from /Users/t/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:735:in `try_func'
from /Users/t/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:966:in `block in have_library'
from /Users/t/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:911:in `block in checking_for'
from /Users/t/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:351:in `block (2 levels) in postpone'
from /Users/t/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /Users/t/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:351:in `block in postpone'
from /Users/t/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:321:in `open'
from /Users/t/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:347:in `postpone'
from /Users/t/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:910:in `checking_for'
from /Users/t/.rbenv/versions/2.2.2/lib/ruby/2.2.0/mkmf.rb:961:in `have_library'
from extconf.rb:6:in `<main>'
extconf failed, exit code 1
Searched for known issues and found Gem unf_ext failed to build gem native extension, but this appears to be related to an older version & an older version of xcode.
Thank you in advance!

Error installing ffi. Faild to build native Extention

I have this note in terminal.
Building native extensions. This could take a while...
ERROR: Error installing ffi:
ERROR: Failed to build gem native extension.
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby -r ./siteconf20150919-3961-k5bsnl.rb extconf.rb
checking for ffi.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=/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/bin/ruby
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/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 /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `block in try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:502:in `with_werror'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:549:in `try_compile'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1044:in `block in have_header'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from /System/Library/Frameworks/Ruby.framework/Versions/2.0/usr/lib/ruby/2.0.0/mkmf.rb:1043:in `have_header'
from extconf.rb:16:in `<main>'
extconf failed, exit code 1
Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/ffi-1.9.6 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/extensions/universal-darwin-14/2.0.0/ffi-1.9.6/gem_make.out
If you have brew than I would recommend that you install ffi library by type in command line
brew install libffi
After that try to install you gem
gem install ffi
There is this line in the error message:
You have to install development tools first.
Please ensure that you have XCode and the Xcode Command Line Toolsinstalled. Please open XCode at least once to accept the licence agreement.

gem install compass not working

having trouble running the line gem install compass in terminal. It's returning the following error. Is anyone able to help out with this problem?
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
/usr/local/rvm/rubies/ruby-1.9.3-p392/bin/ruby -r ./siteconf20150225-51908-cfetpz.rb extconf.rb
checking for ffi.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-1.9.3-p392/bin/ruby
--with-ffi_c-dir
--without-ffi_c-dir
--with-ffi_c-include
--without-ffi_c-include=${ffi_c-dir}/include
--with-ffi_c-lib
--without-ffi_c-lib=${ffi_c-dir}/lib
--with-libffi-config
--without-libffi-config
--with-pkg-config
--without-pkg-config
/usr/local/rvm/rubies/ruby-1.9.3-p392/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 /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:506:in
try_cpp'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:931:in
block in have_header'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:790:in
block in checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:284:in
block (2 levels) in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:254:in
open'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:284:in
block in postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:254:in
open'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:280:in
postpone'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:789:in
checking_for'
from /usr/local/rvm/rubies/ruby-1.9.3-p392/lib/ruby/1.9.1/mkmf.rb:930:in
have_header'
from extconf.rb:16:in'
extconf failed, exit code 1
Gem files will remain installed in /usr/local/rvm/gems/ruby-1.9.3-p392/gems/ffi-1.9.6 for inspection.
Results logged to /usr/local/rvm/gems/ruby-1.9.3-p392/extensions/x86_64-darwin-10/1.9.1-static/ffi-1.9.6/gem_make.out
The error you're getting is
(RuntimeError)
You have to install development tools first.
If you're on OS X (my best guess from the output) you need to install the Xcode developer tools first. You can do this with the command: xcode-select --install.

stuck on installing ruby rails

im following a tutorial to do this and done step by step untill this came up i seen somone had the same issue but wasnt sorted please someone direct me on how to finish off what im asking it to do many thanks
c:\dev\mysql2>gem install mysql2-0.3.13.gem --no-ri --no-rdoc -- --with-mysql-di
r=c:\mysql-connector-c-noinstall-6.0.2-win32
Temporarily enhancing PATH to include DevKit...
Building native extensions with: '--with-mysql-dir=c:\mysql-connector-c-noinstal
l-6.0.2-win32'
This could take a while...
ERROR: Error installing mysql2-0.3.13.gem:
ERROR: Failed to build gem native extension.
C:/Ruby200/bin/ruby.exe extconf.rb --with-mysql-dir=c:\mysql-connector-c-noi
nstall-6.0.2-win32
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
--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=C:/Ruby200/bin/ruby
C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:434:in `try_do': The compiler failed to genera
te an executable file. (RuntimeError)
You have to install development tools first.
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:519:in `try_link0'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:534:in `try_link'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:720:in `try_func'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:1004:in `block in have_func'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:895:in `block in checking_for'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:340:in `block (2 levels) in postp
one'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:340:in `block in postpone'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:310:in `open'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:336:in `postpone'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:894:in `checking_for'
from C:/Ruby200/lib/ruby/2.0.0/mkmf.rb:1003:in `have_func'
from extconf.rb:9:in `<main>'
Gem files will remain installed in C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.
3.13 for inspection.
Results logged to C:/Ruby200/lib/ruby/gems/2.0.0/gems/mysql2-0.3.13/ext/mysql2/g
em_make.out
c:\dev\mysql2>
I would highly reccomend using RailsInstaller to create a development stack on windows.
http://railsinstaller.org/en

Can't install json with gem

I have tried following command in terminal (OSX 10.6.6) and end up with an error. Does anyone know how to solve this?
sudo gem install json
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
/usr/local/bin/ruby extconf.rb
checking for ruby/re.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/bin/ruby
/usr/local/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 /usr/local/lib/ruby/1.9.1/mkmf.rb:452:in `try_cpp'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:834:in `block in have_header'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:693:in `block in checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in `block (2 levels) in postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:280:in `block in postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:254:in `open'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:276:in `postpone'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:692:in `checking_for'
from /usr/local/lib/ruby/1.9.1/mkmf.rb:833:in `have_header'
from extconf.rb:17:in `'
Gem files will remain installed in /usr/local/lib/ruby/gems/1.9.1/gems/json-1.5.1 for inspection.
Results logged to /usr/local/lib/ruby/gems/1.9.1/gems/json-1.5.1/ext/json/ext/generator/gem_make.out
You will need to install XCode. It is available on the AppStore
If XCode is installed and you are still getting this error, maybe you should try using rvm
The reason you're getting this error is because the json gem includes C/C++ extensions that need to be compiled on your machine before they can run.
Just installing XCode won't fix it, you need to specifically install the XCode Command Line Tools. It's a compiler/linker toolchain including C/C++ compilers, make, etc.
There's an option to install them within a menu inside the XCode GUI, see this thread for details:
Xcode 4.4 and later install Command Line Tools
You should be able to get the necessary tools installed by running:
> xcode-select --install

Resources