Ruby on mac - requires don't work

M

Max Williams

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?
 
J

Jari Williamsson

Max said:
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 Williamsson
 
G

Gary Wright

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 Wright
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,768
Messages
2,569,575
Members
45,053
Latest member
billing-software

Latest Threads

Top