Pg gem: LoadError

Hello,

I spent a good deal of time trying to get the "pg" installed on my Mac
OSX 10.6.8. I finally got it successfully installed and using require
'pg' in irb returns true:

require 'pg'

=> true

However, when I make a file called temp and the only line is

require 'pg'

I get this message after running "ruby temp":

temp:1:in `require': no such file to load -- pg (LoadError)
  from temp:1

What am I missing?

Thanks!

···

--
Posted via http://www.ruby-forum.com/\.

Quoting Smash Y. (lists@ruby-forum.com):

I spent a good deal of time trying to get the "pg" installed on my Mac
OSX 10.6.8. I finally got it successfully installed and using require
'pg' in irb returns true:

>> require 'pg'
=> true

However, when I make a file called temp and the only line is

require 'pg'

I get this message after running "ruby temp":

temp:1:in `require': no such file to load -- pg (LoadError)
  from temp:1

What am I missing?

I have no access to any mac. But:

Did you execute both irb and ruby from the same username? Maybe you
have leftovers from multiple installations of Ruby. What do you get
with

ls -l `which irb`

and

ls -l `which ruby`

? It might be useful to know which procedure you followed to compile
and install the postgres extension.

Carlo

···

Subject: pg gem: LoadError
  Date: mar 27 ago 13 06:35:17 +0200

--
  * Se la Strada e la sua Virtu' non fossero state messe da parte,
* K * Carlo E. Prelz - fluido@fluido.as che bisogno ci sarebbe
  * di parlare tanto di amore e di rettitudine? (Chuang-Tzu)

So I found out what the problem was. I discovered it in another random
thread on another random forum. Turns out you have to

require 'rubygems'

before you require anything else on Ruby 1.8. It works now.

···

--
Posted via http://www.ruby-forum.com/.