I’ve installed the latest version of Ferret (0.10.13) on Mac OS X 10.4.8
(Tiger) and I’m developing using Locomotive2. I installed with:
$ gem install ferret
I have a ferret_test.rb file:
----begin---------
require ‘rubygems’
require ‘ferret’
include Ferret
index = Index::Index.new(:path => ‘/opt/search-index’)
----end-----------
I get an error when I run the test:
$ ruby test/ferret_test.rb
/Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in gem_original_require': no such file to load -- ferret_ext (LoadError) from /Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:inrequire’
from
/Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/gems/1.8/gems/ferret-0.10.13/lib/ferret.rb:25
from
/Applications/Locomotive2/Bundles/rmagickRailsSept2006_ppc.locobundle/framework/lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:33:in
`require’
from test/ferret_test.rb:2
How do I resolve this issue? What is “ferret_ext” and why isn’t it here
after the gem install?
I’ve searched the forum and googled without finding more info.
Excerpts from Daniel Kehoe’s message of Sat Dec 30 00:02:56 -0800 2006:
lib/ruby/site_ruby/1.8/rubygems/custom_require.rb:27:in
`gem_original_require’: no such file to load – ferret_ext (LoadError)
I saw this message when “gem install” was unable to compile the C part
of ferret. RubyGems is not very good about handling errors, and will
happily install the gem despite them.
Make sure you have gcc, make, etc. installed, remove and re-install the
gem, and pay close attention to any error messages that might indicate
compilation problems.
I had a stock install of Mac OS X Tiger, without developer tools
installed. When I did the “gem install ferret” I ignored the message
that gcc and make could not be found. RubyGems gave the message that
ferret was installed despite the fact that the C extensions were not
compiled and installed. So I got the error “no such file to load –
ferret_ext” when I tried to run ferret. Here’s what I did to get ferret
to work:
Found my Mac OS X Tiger install disk and opened the Xcode Tools folder.
Clicked on the XcodeTools.mpkg. Started the install process and stopped
before I clicked the “Upgrade” button. Instead clicked the “Customize”
button and selected only “gcc 4.0” and the Software Development Kits
“Mac OS X SDK” and “BSD SDK” (I’m not developing Mac apps so didn’t want
to crowd my disk with extra stuff I won’t use). Then clicked “Upgrade.”
What you need gets installed as /usr/bin/gcc plus lots more in
/usr/include. Now you can install ferret and it will compile the C
extensions.
First I removed the broken ferret I installed earlier:
$ gem uninstall ferret
I checked that I had gcc:
$ which gcc
/usr/bin/gcc
If you can’t find it, check your bash shell path environment with:
$ env
You should have something like
“/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin”
I checked for the SDK libraries:
$ cd /usr/include
$ ls -lag
(should show lots of “.h” header files)
Then back to my development directory and ran:
$ sudo gem install ferret
Select which gem to install for your platform (powerpc-darwin7.9.0)
ferret 0.10.13 (ruby)
…
Building native extensions. This could take a while…
ruby extconf.rb install ferret
creating Makefile
…
(lots of make cruft)
make install
…
make clean
Successfully installed ferret-0.10.13
Installing ri documentation for ferret-0.10.13…
Installing RDoc documentation for ferret-0.10.13…
You can test ferret with this Ruby code in a file “ferret_test.rb”
require ‘rubygems’
require ‘ferret’
include Ferret
puts “ferret works!”
Try it with:
$ ruby ferret_test.rb
ferret works!
I hope this helps someone else who might be in a similar situation,
especially if they are googling for “no such file to load – ferret_ext”
or “Mac OS X gem install ferret” or even “installing gcc on mac os x”.
– Daniel
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.