# Question about -r command line option, rubygems

**URL:** <https://www.ruby-forum.com/t/question-about-r-command-line-option-rubygems/76385>\
**Category:** Ruby\
**Created:** [November 18, 2006, 2:13am UTC](https://www.ruby-forum.com/t/question-about-r-command-line-option-rubygems/76385 "2006-11-18T02:13:58Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [November 18, 2006, 2:13am UTC](https://www.ruby-forum.com/t/question-about-r-command-line-option-rubygems/76385/1 "2006-11-18T02:13:58Z")

</div>

Hi all,

Ruby 1.8.5 (one click)  
Windows XP

I’m trying to require a gem from the command line but it’s failing:

> C:\ruby -rubygems -rturn test.rb  
> ruby: no such file to load – turn (LoadError)

But, I clearly have it installed:

> C:\>ruby -e “require ‘turn’”  
> Loaded suite .  
> ==============================================================================  
> pass: 0, fail: 0, error: 0  
> total: 0 tests with 0 assertions in 0.0 seconds  
> ==============================================================================

What am I doing wrong?

Regards,

Dan

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [November 18, 2006, 2:23am UTC](https://www.ruby-forum.com/t/question-about-r-command-line-option-rubygems/76385/2 "2006-11-18T02:23:58Z")

</div>

Daniel B. wrote:

> But, I clearly have it installed:
> 
> > C:\>ruby -e “require ‘turn’”  
> > Loaded suite .  
> > ==============================================================================
> 
> # pass: 0, fail: 0, error: 0 total: 0 tests with 0 assertions in 0.0 seconds

-r probably only uses the “vanilla” semantics of require, and only  
interpreted code picks up the hacks^Wimprovements that rubygems makes.

David V.

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [November 18, 2006, 5:00pm UTC](https://www.ruby-forum.com/t/question-about-r-command-line-option-rubygems/76385/3 "2006-11-18T17:00:51Z")

</div>

On 11/17/06, Daniel B. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid) wrote:

> But, I clearly have it installed:
> 
> > C:\>ruby -e “require ‘turn’”  
> > Loaded suite .  
> > ==============================================================================  
> > pass: 0, fail: 0, error: 0  
> > total: 0 tests with 0 assertions in 0.0 seconds  
> > ==============================================================================
> 
> What am I doing wrong?

The problem is that unfortunately the -r option doesn’t use the  
hookable require method, but rather the C function that require  
delegates to (which isn’t a Ruby method, so it’s not overrideable).  
So, you’re not doing anything wrong.

Chad

---

<div class="post-metadata">

**Author:** ![danielb](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/d/c57346/32.png) [@danielb](https://www.ruby-forum.com/u/danielb)\
**Post date:** [November 20, 2006, 3:35pm UTC](https://www.ruby-forum.com/t/question-about-r-command-line-option-rubygems/76385/4 "2006-11-20T15:35:59Z")

</div>

Chad F. wrote:

> > What am I doing wrong?
> 
> The problem is that unfortunately the -r option doesn’t use the  
> hookable require method, but rather the C function that require  
> delegates to (which isn’t a Ruby method, so it’s not overrideable).  
> So, you’re not doing anything wrong.

Hm, could it be altered to use the hookable require method? If so, what  
would be the downside?

- Dan
