# Executable ruby

**URL:** <https://www.ruby-forum.com/t/executable-ruby/146736>\
**Category:** Ruby\
**Created:** [August 24, 2008, 9:43pm UTC](https://www.ruby-forum.com/t/executable-ruby/146736 "2008-08-24T21:43:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![jsn1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jsn1](https://www.ruby-forum.com/u/jsn1)\
**Post date:** [August 24, 2008, 9:43pm UTC](https://www.ruby-forum.com/t/executable-ruby/146736/1 "2008-08-24T21:43:15Z")

</div>

hi all

I am trying to make the ruby Hello.rb executable in mac os X  
this is the Hello.rb  
#!/usr/bin/ruby  
print “Hello World”

chmod +x Hello.rb

whe I type: Hello.rb  
I get the following error: tcsh: Hello.rb: Command not found.

---

<div class="post-metadata">

**Author:** ![jsn1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jsn1](https://www.ruby-forum.com/u/jsn1)\
**Post date:** [August 24, 2008, 9:48pm UTC](https://www.ruby-forum.com/t/executable-ruby/146736/2 "2008-08-24T21:48:51Z")

</div>

On Mon Aug 25 04:39:04 2008, Pepe S. wrote:

> whe I type: Hello.rb  
> I get the following error: tcsh: Hello.rb: Command not found.

When you type a command the shell looks at all the directories in your  
$PATH environment variable, and for good reason ./ (your current  
directory) is not included in your path. To execute something in the  
current directory you need to type `./Hello.rb`

---

<div class="post-metadata">

**Author:** ![jsn1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jsn1](https://www.ruby-forum.com/u/jsn1)\
**Post date:** [August 24, 2008, 9:50pm UTC](https://www.ruby-forum.com/t/executable-ruby/146736/3 "2008-08-24T21:50:01Z")

</div>

You would run it like this:

./Hello.rb

Cheers  
Martin

2008/8/24 Pepe S. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid):

---

<div class="post-metadata">

**Author:** ![jsn1](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/7ea924/32.png) [@jsn1](https://www.ruby-forum.com/u/jsn1)\
**Post date:** [August 25, 2008, 2:37am UTC](https://www.ruby-forum.com/t/executable-ruby/146736/4 "2008-08-25T02:37:50Z")

</div>

Hi

I had to change the first line  
#!/usr/bin/env ruby  
print “Hello World”

and run it as you adviced me

./Hello.rb

thanks
