# Ruby on mac - requires don't work

**URL:** <https://www.ruby-forum.com/t/ruby-on-mac-requires-dont-work/129223>\
**Category:** Ruby\
**Created:** [February 15, 2008, 4:21pm UTC](https://www.ruby-forum.com/t/ruby-on-mac-requires-dont-work/129223 "2008-02-15T16:21:38Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [February 15, 2008, 4:21pm UTC](https://www.ruby-forum.com/t/ruby-on-mac-requires-dont-work/129223/1 "2008-02-15T16:21:38Z")

</div>

Hi - i’m trying to write a ruby program on my wife’s mac (i use linux  
normally). In irb i can require a gem fine, but when i write a little  
program, save it on her desktop and run it, the require doesn’t work -  
it can’t find it.

I’m sure it’s just some dumb thing i’ve not done or taken into account.  
Do ruby scripts need to live somewhere in particular, for example?

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [February 15, 2008, 5:03pm UTC](https://www.ruby-forum.com/t/ruby-on-mac-requires-dont-work/129223/2 "2008-02-15T17:03:44Z")

</div>

Max W. wrote:

> Hi - i’m trying to write a ruby program on my wife’s mac (i use linux  
> normally). In irb i can require a gem fine, but when i write a little  
> program, save it on her desktop and run it, the require doesn’t work -  
> it can’t find it.
> 
> I’m sure it’s just some dumb thing i’ve not done or taken into account.  
> Do ruby scripts need to live somewhere in particular, for example?

You probably are missing this line first:  
require ‘rubygems’

Best regards,

Jari W.

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [February 15, 2008, 5:06pm UTC](https://www.ruby-forum.com/t/ruby-on-mac-requires-dont-work/129223/3 "2008-02-15T17:06:05Z")

</div>

Jari W. wrote:

> Max W. wrote:
> 
> > Hi - i’m trying to write a ruby program on my wife’s mac (i use linux  
> > normally). In irb i can require a gem fine, but when i write a little  
> > program, save it on her desktop and run it, the require doesn’t work -  
> > it can’t find it.
> > 
> > I’m sure it’s just some dumb thing i’ve not done or taken into account.  
> > Do ruby scripts need to live somewhere in particular, for example?
> 
> You probably are missing this line first:  
> require ‘rubygems’
> 
> Best regards,
> 
> Jari W.

doh! of course 🙂  
thanks!

---

<div class="post-metadata">

**Author:** ![cmaxvv](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/c/85f322/32.png) [@cmaxvv](https://www.ruby-forum.com/u/cmaxvv)\
**Post date:** [February 15, 2008, 5:10pm UTC](https://www.ruby-forum.com/t/ruby-on-mac-requires-dont-work/129223/4 "2008-02-15T17:10:15Z")

</div>

On Feb 15, 2008, at 10:21 AM, Max W. wrote:

> Hi - i’m trying to write a ruby program on my wife’s mac (i use linux  
> normally). In irb i can require a gem fine, but when i write a little  
> program, save it on her desktop and run it, the require doesn’t work -  
> it can’t find it.

If it is a gem that has gone missing try adding:

require ‘rubygems’

before you attempt to require the gem. I’m assuming the gem is  
installed in the gem repository and isn’t just sitting in a file in a  
working directory somewhere.

Gary W.
