How to build the ferret gem for Ruby 1.9.2 on Mac OS XPublished 2011-04-19
Apparently the ferret gem is not currently supported for Mac OS X on Ruby 1.9.2. Including
gem 'ferret' in your Gemfile and running
bundle install results in the following error, which I've abbreviated:
Installing ferret (0.11.6) with native extensions /Users/dstutzman/.rvm/rubies/ruby-1.9.2-p180/lib/ruby/site_ruby/1.9.1/rubygems/installer.rb:533:in `rescue in block in build_extensions': ERROR: Failed to build gem native extension. (Gem::Installer::ExtensionBuildError) /Users/dstutzman/.rvm/rubies/ruby-1.9.2-p180/bin/ruby extconf.rb creating Makefile ...(snip)... ferret.c: In function 'frt_term_to_s': ferret.c:297: error: 'struct RString' has no member named 'len' ferret.c:297: error: 'struct RString' has no member named 'len' make: *** [ferret.o] Error 1 ...(snip)...
Someone took the trouble to fix this in a blog post. Their solution boils down to using
gem 'sdsykes-ferret' in your Gemfile instead of
gem 'ferret'. You'll probably want to put this inside a platform-specific bundler group.