title: macOS, Rails: "Failed to build gem native extension"
body: <p>I'm stuck trying to install rails on my mac. I have OS X 10.6.8 and I have confirmed that I have Ruby, version 1.8.7</p>
  
  <p>I ran <code>sudo gem update</code> and <code>sudo gem update --system</code> to get the latest versions of the software.</p>
  
  <p>However, when I run <code>sudo gem install rails</code> I get this error:</p>
  
  <pre><code>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.3 for inspection.
  Results logged to /Library/Ruby/Gems/1.8/gems/json-1.6.3/ext/json/ext/parser/gem_make.out
  </code></pre>