# Gem requires not working

**URL:** <https://www.ruby-forum.com/t/gem-requires-not-working/78016>\
**Category:** Ruby\
**Created:** [December 2, 2006, 8:24pm UTC](https://www.ruby-forum.com/t/gem-requires-not-working/78016 "2006-12-02T20:24:14Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![cwd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@cwd](https://www.ruby-forum.com/u/cwd)\
**Post date:** [December 2, 2006, 8:24pm UTC](https://www.ruby-forum.com/t/gem-requires-not-working/78016/1 "2006-12-02T20:24:14Z")

</div>

I feel stupid about this, but I just did a fresh install of 1.8.5 from  
MacPorts, installed a fresh rubygems, installed all my gems, and simple  
code like this fails:

require ‘redcloth’

Error message:

lacosta:~/nitro/tracker sxross$ ruby bug.rb  
bug.rb:1:in `require’: no such file to load – redcloth (LoadError)

The odd thing is that any requires _inside a Rails app_ seem to find the  
gems just fine. I assume that’s because Rails munges the load paths.

Any help is appreciated.

---

<div class="post-metadata">

**Author:** ![cwd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@cwd](https://www.ruby-forum.com/u/cwd)\
**Post date:** [December 2, 2006, 9:50pm UTC](https://www.ruby-forum.com/t/gem-requires-not-working/78016/2 "2006-12-02T21:50:21Z")

</div>

Steve R. wrote:

> The odd thing is that any requires _inside a Rails app_ seem to find the  
> gems just fine. I assume that’s because Rails munges the load paths.  
> Actually it’s because of config/boot.rb in your Rails app. Specifically:  
> require ‘rubygems’

If your code was working before, and didn’t need this, then it’s  
possible that you had had RUBYOPT set.

Devin

---

<div class="post-metadata">

**Author:** ![cwd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@cwd](https://www.ruby-forum.com/u/cwd)\
**Post date:** [December 3, 2006, 12:43am UTC](https://www.ruby-forum.com/t/gem-requires-not-working/78016/3 "2006-12-03T00:43:05Z")

</div>

Devin M. wrote:

> Steve R. wrote:
> 
> > The odd thing is that any requires _inside a Rails app_ seem to find the  
> > gems just fine. I assume that’s because Rails munges the load paths.  
> > Actually it’s because of config/boot.rb in your Rails app. Specifically:  
> > require ‘rubygems’
> 
> If your code was working before, and didn’t need this, then it’s  
> possible that you had had RUBYOPT set.
> 
> Devin

You’re right, it’s the explicit:

require ‘rubygems’

Shouldn’t this be implicit? Or am I misremembering…

Thanks

---

<div class="post-metadata">

**Author:** ![cwd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@cwd](https://www.ruby-forum.com/u/cwd)\
**Post date:** [December 3, 2006, 2:16pm UTC](https://www.ruby-forum.com/t/gem-requires-not-working/78016/4 "2006-12-03T14:16:50Z")

</div>

Steve R. wrote:

> Devin M. wrote:
> 
> > Steve R. wrote:
> > 
> > > The odd thing is that any requires _inside a Rails app_ seem to find the  
> > > gems just fine. I assume that’s because Rails munges the load paths.  
> > > Actually it’s because of config/boot.rb in your Rails app. Specifically:  
> > > require ‘rubygems’
> > 
> > If your code was working before, and didn’t need this, then it’s  
> > possible that you had had RUBYOPT set.
> > 
> > Devin
> 
> You’re right, it’s the explicit:
> 
> require ‘rubygems’
> 
> Shouldn’t this be implicit? Or am I misremembering…
> 
> Thanks

It’s not a standard part of Ruby, it’s an external library, so it should  
remain explicit. If you’re using it on your system you most likely do  
want to set RUBYOPT="-r rubygems".

---

<div class="post-metadata">

**Author:** ![cwd](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/da6949/32.png) [@cwd](https://www.ruby-forum.com/u/cwd)\
**Post date:** [December 3, 2006, 4:43am UTC](https://www.ruby-forum.com/t/gem-requires-not-working/78016/5 "2006-12-03T04:43:51Z")

</div>

On Dec 2, 2006, at 15:43 , Steve R. wrote:

> > possible that you had had RUBYOPT set.
> > 
> > Devin
> 
> You’re right, it’s the explicit:
> 
> require ‘rubygems’
> 
> Shouldn’t this be implicit? Or am I misremembering…

You are misremembering.

Some people set RUBYOPT=-rubygems (or is it RUBY\_OPT?)

–  
Eric H. - removed\_email\_address@domain.invalid - [http://blog.segment7.net](http://blog.segment7.net)

I LIT YOUR GEM ON FIRE!
