Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

can not get my hello.rb file to work

I have ruby running on my terminal and a file saved on my desktop from textedit called hello.rb with puts "Hello World" , it works in irb mode but when i run the command mate hello.rb or ruby hello.rb I get this:

unknown8c2daa390521:~ chaos_theory$ mate hello.rb -bash: mate: command not found unknown8c2daa390521:~ chaos_theory$ ruby hello.rb ruby: No such file or directory -- hello.rb (LoadError)

I dont know what to do

9 Answers

With the command mate, it might not be installed in your system because the error message says "Command not found"

In regards to ruby hello.rb, make sure ruby is installed or you have sufficient privileges to access such command it is usually situated in /usr/bin/ruby

Also, try by running: ruby -v to see if you actually have ruby installed!

Hope it helps!

Ruby should be installed but im not %100 sure, when i enter ruby -v i get this:

unknown8c2daa390521:~ chaos_theory$ ruby -v ruby 2.0.0p0 (2013-02-24 revision 39474) [x86_64-darwin12.3.0]

Ive just been following the videos and this is my first time with ruby so i dont know how to install the mate function or how to access /usr/bin/ruby...... Maybe Im in over my head

Well, it seems like you do have it installed and you are using a Mac.

Instead of trying to use mate, just do some editing with nano. After you are done editing just hit Ctrl + X to exit and say Y to save any change.

Try to do again a simple: ruby hello.rb

It should work. The code should be: puts "Hello World" (Without semicolon at the end)

Why would it not work with mate or textEdit?

Because they are not installed.

Ahhh I see... Nano is new to me, how do I save my work as hello.rb

Thank you I finally got that to work!!! Now my only question is where is my hello.rb file stored at?

I somewhat figured that that out too. At least I figured out "nano hello.rb" ......thank you for your help textMate or textEdit would have had me pulling my hair out all night. lol

No problem :D