Ruby: file-tail: `gem_original_require': no such file to load

Just been trying to play with the file-tail Gem for Ruby and I kept hitting the same error.

#!/usr/bin/env ruby

require 'rubygems'
require 'file-tail'

filename = '/tmp/samplefile.txt' do |log|
  log.interval = 10
  log.tail { |line| puts 
line } end

when run would produce

/Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `gem_original_require': no such file to load -- file-tail (LoadError)
	from /Library/Ruby/Site/1.8/rubygems/custom_require.rb:31:in `require'
	from ./tailtest.rb:4		

Grrr, well after a few minutes of searching I find the answer… that should be:

require 'rubygems'
require 'file/tail'

Note the forward slash in file/tail. It’s caught me out a couple of times now with various Ruby Gems, hopefully by writing it down it’ll stick in my head!

So thanks to this thread where it was actually explicitly mentioned:

Written on 29 Aug 2009 and categorised in Ruby, tagged as filetail, gemoriginalrequire, and Gem

Home, Post archive

site copyright Eric Freeman

Valid XHTML 1.0 Strict