I’m currently teaching myself Ruby and recently needed to install the FXRuby graphical toolkit. I was initially expecting this to be as simple as
sudo gem install fxruby
However running this command on my Mac OS X 10.8 machine returned the following error output
Building native extensions. This could take a while... ERROR: Error installing fxruby: ERROR: Failed to build gem native extension. /Users/dchetwyn/.rvm/rubies/ruby-1.9.3-p194/bin/ruby extconf.rb *** 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/dchetwyn/.rvm/rubies/ruby-1.9.3-p194/bin/ruby --with-fox-dir --without-fox-dir --with-fox-include --without-fox-include=${fox-dir}/include --with-fox-lib --without-fox-lib=${fox-dir}/lib --with-fxscintilla-dir --without-fxscintilla-dir --with-fxscintilla-include --without-fxscintilla-include=${fxscintilla-dir}/include --with-fxscintilla-lib --without-fxscintilla-lib=${fxscintilla-dir}/lib extconf.rb:31:in `find_installed_fox_version': couldn't find FOX header files (RuntimeError) from extconf.rb:134:in `' Gem files will remain installed in /Users/dchetwyn/.rvm/gems/ruby-1.9.3-p194/gems/fxruby-1.6.25 for inspection. Results logged to /Users/dchetwyn/.rvm/gems/ruby-1.9.3-p194/gems/fxruby-1.6.25/ext/fox16/gem_make.out
Although this error message is a little ambiguous, investigation revealed that the error was occurring because the FOX toolkit was not installed on my machine. FXRuby is a Ruby interface to the FOX graphical toolkit, so therefore requires FOX to be installed on the machine first. I already had the Homebrew package manager installed, so installing FOX was as simple as
brew install fox
Running sudo gem install fxruby
a second time then successfully installed FXRuby.
