Require 'rubygems' fails (works in irb)

I am getting errors that rubygems cannot be found, when starting
rails-related ruby commands.

when I run

ls -l `which ruby`

and

cat `which gem` | head -n 1

I get the same directory which is also list in 'gem env'.

somehow ruby does not know where rubygems is.
but if I run it under irb:

irb(main):001:0> require 'rubygems'
=> true

I'm not sure where the missing link is.
I am running on osx here.

Any help much appreciated.
Thanks

···

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

Adam Wilson wrote:

I am getting errors that rubygems cannot be found, when starting
rails-related ruby commands.

Please ask on a Rails mailing list if you are having problems with
Rails. Rails frigs about with the 'require' and rubygems mechanisms in
its own strange ways, and they're nothing to do with Ruby.

somehow ruby does not know where rubygems is.

The Rails mailing list would probably like to see your *exact* error
message.

···

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