Trouble with spreadsheet load error

I’m pretty new to Ruby, but have a basic grasp. I’m trying to read from
a spreadsheet and then play with the contents once I get them into Ruby.
I tried and tried to get the program to run, but kept getting an error
that the spreadsheet library was missing. I installed the library with
sudo gem install and then my program worked… once. Now, I’m getting
the error again. I’ve uninstalled and re-installed the spreadsheet gem.
Still nothing. Any ideas what could cause this?

Running ruby 1.8.7 (249) on OS X 10.7.3

require 'spreadsheet'
Spreadsheet.client_encoding = 'utf-8'

book = Spreadsheet.open '/Users/robert/Desktop/test_set.xls'
sheet1 = book.worksheet 0

collection = Hash.new()

sheet1.each do |row|
  collection.store(row[0], row[1])
end

collection.each do |pair|
  puts pair
end

The error I get is:
duplifind.rb:1:in `require’: no such file to load – spreadsheet
(LoadError)
from duplifind.rb:1

Any help is appreciated, although I know this might be difficult to
solve remotely.

Thanks,
Rob.

More info as I play around with this.

When I try to require spreadsheet in IRB, it works just fine. I get a
return of True. The program works if I type it all into IRB. Is this a
case of the .rb file being in the wrong directory? I was under the
impression it didn’t matter what folder I ran the .rb from.

Thanks,
Rob.

Figured this out, although I’m still not sure how I got it to work once.
I added, require ‘rubygems’ to the first line and now everything is
peachy.

Chalk this up to me being a noob.

Thanks,
Robert.