Unable to compile Ruby native extensions

Originator:hiltmon
Number:rdar://14971783 Date Originated:2013-09-11
Status:Open Resolved:
Product:OS X 10.9 Product Version:
Classification:Major Issue Reproducible:Yes
 
Summary:
On OS X Mavericks DP7 with Xcode5-DP6, I am running an Octopress site. It relies on Ruby gems and uses Ruby Bundler to install them (Not necessary to reproduce error, just setting the stage). When installing gems that require native extensions, get the following error:
---

Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

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


Gem files will remain installed in /Users/Hiltmon/.bundler/tmp/5466/gems/RedCloth-4.2.9 for inspection.
Results logged to /Users/Hiltmon/.bundler/tmp/5466/gems/RedCloth-4.2.9/ext/redcloth_scan/gem_make.out
---

Tested with RedCloth gem, pg gem and bson_ext gem, all the same error.

---
Fetching: bson-1.9.2.gem (100%)
Successfully installed bson-1.9.2
Fetching: bson_ext-1.9.2.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing bson_ext:
	ERROR: Failed to build gem native extension.

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


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/bson_ext-1.9.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/bson_ext-1.9.2/ext/cbson/gem_make.out
---

It seems that the include and lib folders needed for compiling ruby native extensions are missing in OS X Mavericks.

Steps to Reproduce:
1. Install Xcode5-DP6 on Mavericks (needed to compile native extensions)
2. Check Ruby version (ruby 2.0.0p247 (2013-06-27 revision 41674) [universal.x86_64-darwin13])
3. sudo gem install RedCloth (or sudo gem install bson_ext)



Expected Results:
On OS X 10.8 and before, it compiles and installs the gem, no problems.

Actual Results:
Fetching: bson-1.9.2.gem (100%)
Successfully installed bson-1.9.2
Fetching: bson_ext-1.9.2.gem (100%)
Building native extensions.  This could take a while...
ERROR:  Error installing bson_ext:
	ERROR: Failed to build gem native extension.

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


Gem files will remain installed in /Library/Ruby/Gems/2.0.0/gems/bson_ext-1.9.2 for inspection.
Results logged to /Library/Ruby/Gems/2.0.0/gems/bson_ext-1.9.2/ext/cbson/gem_make.out

Version:
OS X 10.9 13A569

Notes:
Since a lot of OS X Users work with ruby, I think this is a big issue.

FYI using `rbenv` from home-brew works around the issue, but it's not for the faint hearted.

Configuration:


Attachments:

Comments


Please note: Reports posted here will not necessarily be seen by Apple. All problems should be submitted at bugreport.apple.com before they are posted here. Please only post information for Radars that you have filed yourself, and please do not include Apple confidential information in your posts. Thank you!