Problem Installing Rails on Ruby 1.9.3

I am trying to install rails on Ruby 1.9.3.

When I execute the command:
$ sudo gem install rails

I receive the error below. How do I resolve this?

Building native extensions. This could take a while...
ERROR: Error installing rails:
  ERROR: Failed to build gem native extension.

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb
mkmf.rb can't find header files for ruby at
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

Gem files will remain installed in
/Library/Ruby/Gems/1.8/gems/json-1.6.6 for inspection.
Results logged to
/Library/Ruby/Gems/1.8/gems/json-1.6.6/ext/json/ext/generator/gem_make.out
Benjamins-MacBook-Air:~ benrweiss$ sudo gem install rails
Password:
Building native extensions. This could take a while...
ERROR: Error installing rails:
  ERROR: Failed to build gem native extension.

        /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby
extconf.rb
mkmf.rb can't find header files for ruby at
/System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/lib/ruby/ruby.h

Gem files will remain installed in
/Library/Ruby/Gems/1.8/gems/json-1.6.6 for inspection.
Results logged to
/Library/Ruby/Gems/1.8/gems/json-1.6.6/ext/json/ext/generator/gem_make.out

···

--
Posted via http://www.ruby-forum.com/.

I too faced the same issue. I have installed the Ruby 1.9.3.
When i tried to create a new rails application, it throws the following
error.

Installing json (1.6.6) with native extensions The system cannot find
the path specified.
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:551:in `rescue
in block in build_extensions': ERROR: Failed to build gem native
extension. (Gem::Installer::ExtensionBuildError)

        C:/Ruby192/bin/ruby.exe extconf.rb
creating Makefile

Gem files will remain installed in
C:/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.6.
6 for inspection.
Results logged to
C:/Ruby192/lib/ruby/gems/1.9.1/gems/json-1.6.6/ext/json/ext/ge
nerator/gem_make.out
        from
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:529:in `b
lock in build_extensions'
        from
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `e
ach'
        from
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:504:in `b
uild_extensions'
        from
C:/Ruby192/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:180:in `i
nstall'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/sour
ce.rb:101:in `block in install'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/ruby
gems_integration.rb:78:in `preserve_paths'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/sour
ce.rb:91:in `install'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/inst
aller.rb:58:in `block (2 levels) in run'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/ruby
gems_integration.rb:93:in `with_build_args'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/inst
aller.rb:57:in `block in run'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec
_set.rb:12:in `block in each'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec
_set.rb:12:in `each'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/spec
_set.rb:12:in `each'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/inst
aller.rb:49:in `run'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/inst
aller.rb:8:in `install'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/cli.
rb:222:in `install'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/vend
or/thor/task.rb:22:in `run'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/vend
or/thor/invocation.rb:118:in `invoke_task'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/vend
or/thor.rb:246:in `dispatch'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/lib/bundler/vend
or/thor/base.rb:389:in `start'
        from
C:/Ruby192/lib/ruby/gems/1.9.1/gems/bundler-1.0.15/bin/bundle:13:in
`<top (required)>'
        from C:/Ruby192/bin/bundle:19:in `load'
        from C:/Ruby192/bin/bundle:19:in `<main>'

After i searched in Google i found that, there is some issue(
https://github.com/carlhuda/bundler/issues/1809) with json 1.6.6.
So i update the gem file with, gem 'json', '1.6.5' and i am able to
solve this error.

Hopefully this will help you to solve this problem.
You just try to install the json 1.6.5 seperately and this problem will
get solved.

Thanks,
Mani

···

--
Posted via http://www.ruby-forum.com/.

Sorry for the basic question, but I am just getting started with ruby.

How do I install json 1.6.5.

I am only seeing json 1.6.6. on ruby gems.

···

--
Posted via http://www.ruby-forum.com/.

Ben W. wrote in post #1054935:

Sorry for the basic question, but I am just getting started with ruby.

How do I install json 1.6.5.

I am only seeing json 1.6.6. on ruby gems.

You just give gen uninstall command as like below.

E:\rails_testing\outsidein>gem uninstall json

Select gem to uninstall:
1. json-1.6.3
2. json-1.6.4
3. json-1.6.5
4. All versions

It will ask for what version need to uninstall. When you give the
required number, the particular gem will be uninstalled.

In that way you can uninstall the json 1.6.6.

Then you can install it by,

E:\rails_testing\outsidein>gem install json 1.6.5

Hope this will help you.

Mani

···

--
Posted via http://www.ruby-forum.com/\.