On Sep 16, 9:57=A0pm, Howard Brazee <how... / brazee.net> wrote:
> On Thu, 16 Sep 2010 13:11:36 -0500, Charles Roper
>
> <reac... / charlesroper.co.uk> wrote:
> >> How do I run that same program when I copy it to my Mac?
>
> >You do more or less the same thing, only on the Mac you'd open
> >Terminal, then cd to wherever you place the file. Note, however, that
> >on a Mac you'd use forward slashes instead of backslashes in the path;
> >e.g,
>
> >cd ~/Code/Ruby/
>
> I opened terminal in that directory (using Path Finder), and tried the
> following:
>
> cd "/C:/Documents and Settings/brazee/My Documents/code/Ruby"
> Last login: Thu Sep 16 18:53:59 on ttys000
> Kernel Information: =A0Darwin 10.4.0 i386
> \e[0;33mGNU bash, version 3.2.48(1)-release (x86_64-apple-darwin10.0)
> Copyright (C) 2007 Free Software Foundation, Inc.
> \e[1;30mUptime: 18:55 =A0up 4 days, =A01:16, 3 users, load averages: 0.22
> 0.25 0.37
> \e[1;30mServer time is: Thu Sep 16 18:55:01 MDT 2010
> ~ > cd "/C:/Documents and Settings/brazee/My Documents/code/Ruby"
> /C:/Documents and Settings/brazee/My Documents/code/Ruby > ls
> 99Bottles.rb =A099BottlesR.rb Hello.rb
> /C:/Documents and Settings/brazee/My Documents/code/Ruby > hello.rb
> -bash: hello.rb: command not found
> /C:/Documents and Settings/brazee/My Documents/code/Ruby > Hello.rb
> -bash: Hello.rb: command not found
> /C:/Documents and Settings/brazee/My Documents/code/Ruby >
>
> (Yes, that is on my Mac - I synchronize some documents between work
> and home by having that weird path).
>

hello.rb is not marked as executable (chmod +x) to be invoked
directly.

Also, you need to invoke from the same directory like "./hello.rb"
since "." is not in the PATH.

Avoid troubles and invoke your scripts *always* preceding with ruby:

ruby hello.rb

That works across platforms.

--
Luis Lavena