Failed to build gem native extension — Rails install - ruby-on-rails

I have been installing Ruby on Rails based on the instruction from edX online class.
Here is a list of terminal commands, and, where relevant, corresponding output:
$ sudo apt-get install ruby1.9.1
installation successful
$ wget http://production.cf.rubygems.org/rubygems/rubygems-1.8.24.tgz
$ tar zxvf ruby-1.8.24.tgz
$ cd ruby-1..8.24
$ sudo ruby setup.rb
RubyGems 1.8.24 installed
== 1.8.24 / 2012-04-27
* 1 bug fix:
* Install the .pem files properly. Fixes #320
* Remove OpenSSL dependency from the http code path
------------------------------------------------------------------------------
RubyGems installed the following executables:
/usr/bin/gem1.9.1
Up to here, everything looked fine, but the I tried to install rails and failed:
$ sudo gem install rails
Fetching: i18n-0.6.1.gem (100%)
Fetching: multi_json-1.3.6.gem (100%)
Fetching: activesupport-3.2.8.gem (100%)
Fetching: builder-3.0.3.gem (100%)
Fetching: activemodel-3.2.8.gem (100%)
Fetching: rack-1.4.1.gem (100%)
Fetching: rack-cache-1.2.gem (100%)
Fetching: rack-test-0.6.1.gem (100%)
Fetching: journey-1.0.4.gem (100%)
Fetching: hike-1.2.1.gem (100%)
Fetching: tilt-1.3.3.gem (100%)
Fetching: sprockets-2.1.3.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: actionpack-3.2.8.gem (100%)
Fetching: arel-3.0.2.gem (100%)
Fetching: tzinfo-0.3.33.gem (100%)
Fetching: activerecord-3.2.8.gem (100%)
Fetching: activeresource-3.2.8.gem (100%)
Fetching: mime-types-1.19.gem (100%)
Fetching: polyglot-0.3.3.gem (100%)
Fetching: treetop-1.4.10.gem (100%)
Fetching: mail-2.4.4.gem (100%)
Fetching: actionmailer-3.2.8.gem (100%)
Fetching: rake-0.9.2.2.gem (100%)
Fetching: rack-ssl-1.3.2.gem (100%)
Fetching: thor-0.16.0.gem (100%)
Fetching: json-1.7.5.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:1:in `<main>'
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/json-1.7.5 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/json-1.7.5/ext/json/ext/generator/gem_make.out

mkmf is part of the ruby1.9.1-dev package. This package contains the header files needed for extension libraries for Ruby 1.9.1. You need to install the ruby1.9.1-dev package by doing:
sudo apt-get install ruby1.9.1-dev
Then you can install Rails as per normal.
Generally it's easier to just do:
sudo apt-get install ruby-dev

The suggested answer only works for certain versions of ruby. Some commenters suggest using ruby-dev; that didn't work for me either.
sudo apt-get install ruby-all-dev
worked for me.

sudo apt-get install ruby-dev
worked for me

Related

ruby gem compass installation error

I am trying to install gem compass, but I am getting the following error while running sudo gem install compass
Fetching: sass-3.4.22.gem (100%)
Fetching: multi_json-1.12.1.gem (100%)
Fetching: compass-core-1.0.3.gem (100%)
Fetching: compass-import-once-1.0.5.gem (100%)
Fetching: chunky_png-1.3.8.gem (100%)
Fetching: rb-fsevent-0.9.8.gem (100%)
Fetching: ffi-1.9.14.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing compass:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require': cannot load such file -- mkmf (LoadError)
from /usr/lib/ruby/1.9.1/rubygems/custom_require.rb:36:in `require'
from extconf.rb:4:in `<main>'
Gem files will remain installed in /var/lib/gems/1.9.1/gems/ffi-1.9.14 for inspection.
Results logged to /var/lib/gems/1.9.1/gems/ffi-1.9.14/ext/ffi_c/gem_make.out
My gem version is 1.8.23
please try this first.
xcode-select --install
sudo gem update --system
sudo gem install compass
If this not working then
sudo apt-get remove ruby
apt-get autoremove
sudo apt-get install ruby2.2(Change from your ruby version)
sudo gem install compass

Installing rails and RVm

newbee here. Hope you can help me with this.
rails -v
Rails is not currently installed on this system. To get the latest version, simply type:
$ sudo gem install railsYou can then rerun your "rails" command.
KrisOrqla:~ Kris$ sudo gem install rails
Password:
Failed to load /Users/Kris/.gemrc because it doesn't contain valid YAML hash
Fetching: minitest-5.4.2.gem (100%)
Successfully installed minitest-5.4.2
Fetching: tzinfo-1.2.2.gem (100%)
Successfully installed tzinfo-1.2.2
Fetching: i18n-0.6.11.gem (100%)
Successfully installed i18n-0.6.11
Fetching: activesupport-4.1.6.gem (100%)
Successfully installed activesupport-4.1.6
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: builder-3.2.2.gem (100%)
Successfully installed builder-3.2.2
Fetching: actionview-4.1.6.gem (100%)
Successfully installed actionview-4.1.6
Fetching: rack-1.5.2.gem (100%)
Successfully installed rack-1.5.2
Fetching: rack-test-0.6.2.gem (100%)
Successfully installed rack-test-0.6.2
Fetching: actionpack-4.1.6.gem (100%)
Successfully installed actionpack-4.1.6
ERROR: While executing gem ... (Gem::RemoteFetcher::UnknownHostError)
no such name (https://api.rubygems.org/gems/tilt-1.4.1.gem) ( ITS SAYS ERROR)
I type rails -v again but the problem occured!
Thanks
Your rails gem not installed properly yet. While we install rails gem first all the dependency gems installed then rails install. Rails dependency gem tilt not installed properly here. try run sudo gem install tilt -v='1.4.1' separately then again run sudo gem install rails. then check rails gem present in your gem list.
i already solved this problem. Ruby and Rails were successfully installed. I just followed these two for instructions. (http://installrails.com/steps/choose_os) and (http://docs.railsbridge.org/installfest/osx_rvm?back=macintosh%23step2-1)

Uninstall Rails completely

I’m trying to uninstall Rails completely, but I can’t get the grip of it.
Here’s what I tried:
$ gem update
rails 4.0.0.beta1 installed
$ rails -v
Rails 4.0.0.beta1
$ gem uninstall rails -v 4.0.0.beta1
BUT STILL:
$ rails -v
Rails 4.0.0.beta1
How I can completely remove rails version ?
Finally solution
Just uninstall railties -v 4.0.0, and everything just fine.
$ which rails
~/software/bin/rails
$ rails -v
Rails 4.0.0
$ gem list | grep rails
rails (4.0.0, 3.2.13, 3.2.9, 3.2.6)
$ gem uninstall rails -v 4.0.0
You have requested to uninstall the gem:
rails-4.0.0
figaro-0.7.0 depends on [rails (< 5, >= 3)]
.....
.....
Continue with Uninstall? [Yn] y
Successfully uninstalled rails-4.0.0
$ gem list | grep rails
rails (3.2.13, 3.2.9, 3.2.6)
$ rails -v
Rails 4.0.0
$ gem uninstall railties -v 4.0.0
You have requested to uninstall the gem:
railties-4.0.0
coffee-rails-4.0.0 depends on [railties (< 5.0, >= 4.0.0.beta)]
....
....
If you remove this gems, one or more dependencies will not be met.
Continue with Uninstall? [Yn] y
Successfully uninstalled railties-4.0.0
$ rails -v
Rails 3.2.13
See! rails version back normal!!
Here the reason:
$ tail `which rails`
str = ARGV.first
str = str.dup.force_encoding("BINARY") if str.respond_to? :force_encoding
if str =~ /\A_(.*)_\z/
version = $1
ARGV.shift
end
end
gem 'railties', version
load Gem.bin_path('railties', 'rails', version)
Earlier try
Well, I did everything I found in Internet, but nothing works fine. And I just delete the gem folder, install rails 3.2.12, and it works...
There are all 31 gems installed
# rm -rf /usr/local/lib/ruby/gems/
# gem list
*** LOCAL GEMS ***
# gem cleanup
Cleaning up installed gems...
Clean Up Complete
# gem update --system
# gem install rails -v 3.2.12
Fetching: i18n-0.6.5.gem (100%)
Successfully installed i18n-0.6.5
Fetching: multi_json-1.8.2.gem (100%)
Successfully installed multi_json-1.8.2
Fetching: activesupport-3.2.12.gem (100%)
Successfully installed activesupport-3.2.12
Fetching: builder-3.0.4.gem (100%)
Successfully installed builder-3.0.4
Fetching: activemodel-3.2.12.gem (100%)
Successfully installed activemodel-3.2.12
Fetching: rack-1.4.5.gem (100%)
Successfully installed rack-1.4.5
Fetching: rack-cache-1.2.gem (100%)
Successfully installed rack-cache-1.2
Fetching: rack-test-0.6.2.gem (100%)
Successfully installed rack-test-0.6.2
Fetching: journey-1.0.4.gem (100%)
Successfully installed journey-1.0.4
Fetching: hike-1.2.3.gem (100%)
Successfully installed hike-1.2.3
Fetching: tilt-1.4.1.gem (100%)
Successfully installed tilt-1.4.1
Fetching: sprockets-2.2.2.gem (100%)
Successfully installed sprockets-2.2.2
Fetching: erubis-2.7.0.gem (100%)
Successfully installed erubis-2.7.0
Fetching: actionpack-3.2.12.gem (100%)
Successfully installed actionpack-3.2.12
Fetching: arel-3.0.2.gem (100%)
Successfully installed arel-3.0.2
Fetching: tzinfo-0.3.38.gem (100%)
Successfully installed tzinfo-0.3.38
Fetching: activerecord-3.2.12.gem (100%)
Successfully installed activerecord-3.2.12
Fetching: activeresource-3.2.12.gem (100%)
Successfully installed activeresource-3.2.12
Fetching: mime-types-1.25.gem (100%)
Successfully installed mime-types-1.25
Fetching: polyglot-0.3.3.gem (100%)
Successfully installed polyglot-0.3.3
Fetching: treetop-1.4.15.gem (100%)
Successfully installed treetop-1.4.15
Fetching: mail-2.4.4.gem (100%)
Successfully installed mail-2.4.4
Fetching: actionmailer-3.2.12.gem (100%)
Successfully installed actionmailer-3.2.12
Fetching: rake-10.1.0.gem (100%)
Successfully installed rake-10.1.0
Fetching: rack-ssl-1.3.3.gem (100%)
Successfully installed rack-ssl-1.3.3
Fetching: thor-0.18.1.gem (100%)
Successfully installed thor-0.18.1
Fetching: json-1.8.0.gem (100%)
Building native extensions. This could take a while...
Successfully installed json-1.8.0
Fetching: rdoc-3.12.2.gem (100%)
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Successfully installed rdoc-3.12.2
Fetching: railties-3.2.12.gem (100%)
Successfully installed railties-3.2.12
Fetching: bundler-1.3.5.gem (100%)
Successfully installed bundler-1.3.5
Fetching: rails-3.2.12.gem (100%)
Successfully installed rails-3.2.12
... rdoc stuff ...
31 gems installed
Here are something weird
I'v $ sudo gem uninstall rails -v 4.0.0 and $ sudo gem cleanup and install rails 3.2.13 ($ sudo gem install rails -v 3.2.13), only 15 gems installed:
$ sudo gem install rails -v 3.2.13
Fetching: i18n-0.6.1.gem (100%)
Fetching: activesupport-3.2.13.gem (100%)
Fetching: builder-3.0.4.gem (100%)
Fetching: activemodel-3.2.13.gem (100%)
Fetching: rack-1.4.5.gem (100%)
Fetching: sprockets-2.2.2.gem (100%)
Fetching: actionpack-3.2.13.gem (100%)
Fetching: arel-3.0.2.gem (100%)
Fetching: tzinfo-0.3.38.gem (100%)
Fetching: activerecord-3.2.13.gem (100%)
Fetching: activeresource-3.2.13.gem (100%)
Fetching: actionmailer-3.2.13.gem (100%)
Fetching: rdoc-3.12.2.gem (100%)
Depending on your version of ruby, you may need to install ruby rdoc/ri data:
<= 1.8.6 : unsupported
= 1.8.7 : gem install rdoc-data; rdoc-data --install
= 1.9.1 : gem install rdoc-data; rdoc-data --install
>= 1.9.2 : nothing to do! Yay!
Fetching: railties-3.2.13.gem (100%)
Successfully installed i18n-0.6.1
Successfully installed activesupport-3.2.13
Successfully installed builder-3.0.4
Successfully installed activemodel-3.2.13
Successfully installed rack-1.4.5
Successfully installed sprockets-2.2.2
Successfully installed actionpack-3.2.13
Successfully installed arel-3.0.2
Successfully installed tzinfo-0.3.38
Successfully installed activerecord-3.2.13
Successfully installed activeresource-3.2.13
Successfully installed actionmailer-3.2.13
Successfully installed rdoc-3.12.2
Successfully installed railties-3.2.13
Successfully installed rails-3.2.13
15 gems installed
... rdoc stuff ...
And rails -v:
$ rails -v
/usr/local/lib/ruby/1.9.1/rubygems/dependency.rb:247:in `to_specs': Could not find minitest (~> 4.2) amongst [actionmailer-4.0.0, actionmailer-3.2.13, actionpack-4.0.0, actionpack-3.2.13, activemodel-4.0.0, activemodel-3.2.13, activerecord-4.0.0, activerecord-3.2.13, activerecord-deprecated_finders-1.0.3, activeresource-4.0.0, activeresource-3.2.13, activesupport-4.0.0, activesupport-3.2.13, addressable-2.3.3, arel-4.0.0, arel-3.0.2, atomic-1.1.14, bcrypt-ruby-3.0.1, better_errors-0.8.0, bigdecimal-1.2.1, binding_of_caller-0.7.1, bootstrap-sass-2.3.1.0, builder-3.2.2, builder-3.0.4, bundler-1.3.5, cancan-1.6.9, capybara-2.0.3, childprocess-0.3.9, coderay-1.0.9, coffee-rails-4.0.0, coffee-script-2.2.0, coffee-script-source-1.6.3, countries-0.9.2, cucumber-1.2.3, cucumber-rails-1.3.1, currencies-0.4.0, database_cleaner-1.0.0.RC1, debug_inspector-0.0.2, devise-2.2.3, diff-lcs-1.2.2, email_spec-1.4.0, erubis-2.7.0, execjs-2.0.2, factory_girl-4.2.0, factory_girl_rails-4.2.1, ffi-1.6.0, figaro-0.6.3, gherkin-2.11.6, hike-1.2.3, httpclient-2.3.3, httpi-2.0.2, i18n-0.6.5, i18n-0.6.1, io-console-0.4.2, jbuilder-1.5.1, journey-1.0.4, jquery-rails-3.0.4, json-1.8.0, launchy-2.2.0, libv8-3.16.14.3, mail-2.5.4, mime-types-1.25, minitest-5.0.8, multi_json-1.8.1, mysql2-0.3.13, nokogiri-1.5.9, orm_adapter-0.4.0, polyglot-0.3.3, quiet_assets-1.0.2, rack-1.5.2, rack-1.4.5, rack-cache-1.2, rack-ssl-1.3.3, rack-test-0.6.2, rails-3.2.13, rails-observers-0.1.2, railties-4.0.0, railties-3.2.13, rake-10.1.0, rdoc-4.0.1, rdoc-3.12.2, recurly-2.1.8, ref-1.0.5, rolify-3.2.0, rspec-core-2.13.1, rspec-expectations-2.13.0, rspec-mocks-2.13.0, rspec-rails-2.13.0, rubyzip-0.9.9, sass-3.2.12, sass-rails-4.0.0, sdoc-0.3.20, selenium-webdriver-2.31.0, simple_form-2.1.0, sprockets-2.10.0, sprockets-2.2.2, sprockets-rails-2.0.0, therubyracer-0.12.0, thor-0.18.1, thread_safe-0.1.3, tilt-1.4.1, treetop-1.4.15, turbolinks-1.3.0, tzinfo-1.1.0, tzinfo-0.3.38, uglifier-2.2.1, warden-1.2.1, websocket-1.0.7, xpath-1.0.0] (Gem::LoadError)
from /usr/local/lib/ruby/1.9.1/rubygems/specification.rb:777:in `block in activate_dependencies'
from /usr/local/lib/ruby/1.9.1/rubygems/specification.rb:766:in `each'
from /usr/local/lib/ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies'
from /usr/local/lib/ruby/1.9.1/rubygems/specification.rb:750:in `activate'
from /usr/local/lib/ruby/1.9.1/rubygems/specification.rb:780:in `block in activate_dependencies'
from /usr/local/lib/ruby/1.9.1/rubygems/specification.rb:766:in `each'
from /usr/local/lib/ruby/1.9.1/rubygems/specification.rb:766:in `activate_dependencies'
from /usr/local/lib/ruby/1.9.1/rubygems/specification.rb:750:in `activate'
from /usr/local/lib/ruby/1.9.1/rubygems.rb:1232:in `gem'
from /usr/local/bin/rails:22:in `<main>'
Rails 4.0.0 cannot be removed by uninstall completely, is that a bug?
2 steps to completely remove rails from system
1) gem uninstall rails
2) gem uninstall railties
select the versions which you want to uninstall.
in case someone else gets here, i found i had to uninstall railties also.
gem uninstall railties
Check all the directories you might have installed rails in, from your /~user down
If you are using rvm, you can uninstall all gems by deleting .gem directory in you $HOME
rm -rf ~/.gem
or uninstall only rails:
gem uninstall -a rails
or if you installed using sudo:
sudo gem uninstall -a rails
You haven't specified which gem to uninstall, try gem uninstall rails.
sudo gem uninstall rails -v 4.0.0.beta1
It should help.
First you should understand what is the location of rails.
Type in your console (bash, zsh, etc.)
which rails
If it's located in your home folder, like:
/home/your_name/.rvm/gems/ruby-1.9.3-p392/bin/rails
Then, you should remove it using local gem:
gem uninstall rails
Otherwise, you probably have to use sudo:
sudo gem uninstall rails
NOTE: you can check your rails versions as following:
Local:
gem list rails
Global:
sudo gem list rails
I also had to uninstall Railties and everything worked right.
you just try this command.it will help to uninstall all rails
"gem uninstall railties"
I think this is the only method to fully uninstall all rails
Had similar issue, this was the solution:
sudo gem uninstall rails
sudo gem uninstall railties

Gems suddenly missing

I'm just learning how to use Ruby on Rails and everything was fine.
But today, as I tried to use the command rails new foo or even rails -v it gave me this:
C:\Users\Me\Ruby>rails new demo_app C:/Program Files
(x86)/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems.rb:926:in `r
eport_activate_error': Could not find RubyGem railties (>= 0)
(Gem::LoadError)
from C:/Program Files (x86)/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems .rb:244:in
`activate_dep'
from C:/Program Files (x86)/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems
.rb:236:in
activate'
from C:/Program Files (x86)/ruby-1.9.2/lib/ruby/site_ruby/1.9.1/rubygems .rb:1307:ingem'
from C:/Ruby193/bin/rails:22:in `'
So... whats going wrong?
gem list rails gave me this:
C:\Users\Me\Ruby>gem list rails
*** LOCAL GEMS ***
I'm using Windows 7 and have no rvm or pik, but it worked fine the last 5 days.
Okay, i tried to install rails new with 'gem install rails'
and it said this:
C:\Users\Me\Ruby>gem install rails
Fetching: i18n-0.6.1.gem (100%)
Fetching: multi_json-1.5.0.gem (100%)
Fetching: activesupport-3.2.11.gem (100%)
Fetching: builder-3.0.4.gem (100%)
Fetching: activemodel-3.2.11.gem (100%)
Fetching: rack-1.4.5.gem (100%)
Fetching: rack-cache-1.2.gem (100%)
Fetching: rack-test-0.6.2.gem (100%)
Fetching: journey-1.0.4.gem (100%)
Fetching: hike-1.2.1.gem (100%)
Fetching: tilt-1.3.3.gem (100%)
Fetching: sprockets-2.2.2.gem (100%)
Fetching: erubis-2.7.0.gem (100%)
Fetching: actionpack-3.2.11.gem (100%)
Fetching: arel-3.0.2.gem (100%)
Fetching: tzinfo-0.3.35.gem (100%)
Fetching: activerecord-3.2.11.gem (100%)
Fetching: activeresource-3.2.11.gem (100%)
Fetching: polyglot-0.3.3.gem (100%)
Fetching: treetop-1.4.12.gem (100%)
Fetching: mail-2.4.4.gem (100%)
Fetching: actionmailer-3.2.11.gem (100%)
Fetching: rack-ssl-1.3.3.gem (100%)
Fetching: json-1.7.6.gem (100%)
ERROR: Error installing rails:
The 'json' native gem requires installed build tools.
Please update your PATH to include build tools or download the DevKit
from 'http://rubyinstaller.org/downloads' and follow the instructions
at 'http://github.com/oneclick/rubyinstaller/wiki/Development-Kit'
Well... i already installed DevKit 5 days ago, but i did it again, this time starting the command line as Admin.
Then i 'tried' to install json:
C:\Users\Me\DevKit>gem install json
Temporarily enhancing PATH to include DevKit...
Building native extensions. This could take a while...
ERROR: Error installing json:
ERROR: Failed to build gem native extension.
"C:/Program Files (x86)/ruby-1.9.2/bin/ruby.exe" extconf.rb
creating Makefile
make
Makefile:160: warning: overriding commands for target `C:/Program'
Makefile:153: warning: ignoring old commands for target `C:/Program'
Makefile:160: warning: overriding commands for target `Files'
Makefile:153: warning: ignoring old commands for target `Files'
C:/Program Files (x86)/ruby-1.9.2/bin/ruby -e "puts 'EXPORTS', 'Init_generator'"
> generator-i386-mingw32.def
/bin/sh: -c: line 0: syntax error near unexpected token `('
/bin/sh: -c: line 0: `C:/Program Files (x86)/ruby-1.9.2/bin/ruby -e "puts 'EXPOR
TS', 'Init_generator'" > generator-i386-mingw32.def'
make: *** [generator-i386-mingw32.def] Error 2
Gem files will remain installed in C:/Program Files (x86)/ruby-1.9.2/lib/ruby/ge
ms/1.9.1/gems/json-1.7.6 for inspection.
Results logged to C:/Program Files (x86)/ruby-1.9.2/lib/ruby/gems/1.9.1/gems/jso
n-1.7.6/ext/json/ext/generator/gem_make.out
And i got this-.-
Im really a beginner in this, so i dont know anything else i could try.
You probably messed up your ruby/rails installation at some point.
I highly recommend using RailsInstaller which takes care of installing Ruby, Rails and all the gotchas (DevKit etc) for you, in one click.
Of course you should uninstall everything first.
Well now, i just reinstalled everything, but before doing that i realized that i was in the windows command line. With the git bash i had no problems (ok, not the same, thats why i reinstalled the whole thing). And now everything works fine again.

Not able to install rails version 3.2.x in linux mint 14.1

I am using Rails 2.3.14 problem is i want to update rails version to 3.2.x
1. sudo gem update rails
-Updating installed gems
-Nothing to update
2.when i used sudo apt-get update rails
-The update command takes no arguments
3.when i tried to install Rails sudo gem install rails --version=3.2.3
-Fetching: activesupport-3.2.3.gem (100%)
Fetching: builder-3.0.4.gem (100%)
Fetching: activemodel-3.2.3.gem (100%)
Fetching: rack-1.4.4.gem (100%)
Fetching: sprockets-2.1.3.gem (100%)
Fetching: actionpack-3.2.3.gem (100%)
Fetching: activerecord-3.2.3.gem (100%)
Fetching: activeresource-3.2.3.gem (100%)
Fetching: mail-2.4.4.gem (100%)
Fetching: actionmailer-3.2.3.gem (100%)
Fetching: thor-0.14.6.gem (100%)
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
/usr/bin/ruby1.9.1 extconf.rb
/usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:in require': cannot load such file -- mkmf (LoadError)
from /usr/local/lib/site_ruby/1.9.1/rubygems/custom_require.rb:36:inrequire'
from extconf.rb:1:in `'
Gem files will remain installed in /usr/lib/ruby/gems/1.9.1/gems/json-1.7.6 for inspection.
Results logged to /usr/lib/ruby/gems/1.9.1/gems/json-1.7.6/ext/json/ext/generator/gem_make.out
Can anybody suggest me how can i overcome this issue.
first install
sudo aptitude install ruby1.9.1-dev
will solve your problem

Resources