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! While you're at it, check out some resources Treehouse students have shared here.

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

Ruby

He make it seem easy

okay, i don't know if the teachers are running mavericks, but i am copying what they are doing and it's not working for me, i,m trying to figure how to run a simple ruby program in the terminal: i have it save in textmate then i try to run it in the terminal and it says

King-Georges-MacBook-Pro:~ King-Gorge$ ruby vars.rb ruby: No such file or directory -- vars.rb (LoadError) King-Georges-MacBook-Pro:~ King-Gorge$

13 Answers

it has to be in your user folder so open a new finder window and you should see your device on the side. Click that then Mackintosh HD then Users then your user. Put the Development file in there.

I suggest you look into this course. You should have a good understanding of how to work in the terminal.

http://teamtreehouse.com/library/console-foundations-2

To do this correctly. I would put a Projects folder into your user directory. So let's say that is "Kelvin" on your Mac. Then you open finder, on the toolbar at top, click "Go -> Home". Add your folder here. So the folder now is located at Users/Kelvin/Projects.

When you open a terminal, it automatically brings you to Users/Kelvin. So we use "cd Projects" to change directory to projects. Now we are located at Users/Kelvin/Projects in the terminal and any files stored in this folder can now be run.

Thats explained much better

that or cd desktop first then cd development Thats probably easier

Agreed!

You can't have a space in the name of the file. Terminal is trying to run vars.rb instead of ruby vars.rb Replace the space with _ to make it easier to read: ruby_vars.rb

I don't believe he had a space in his file name. Isn't he running the ruby command with the filename "vars.rb"?

The error is indicating that your working directory is not the same directory as where you saved the file.

but the teacher has a space in his: $ruby variable_intro.rb 1 $

okay so i went and renamed my exactly like the teacher has his and it's still a no go???

Is it still saying that there is no file or directory?

$ruby varible_intro.rb and the terminal returned 1 for him

yes

Where did you create the file?

textmate

he saved this to his textmate file a = 1 puts a :: i understand that, but why not run in the terminal?

OK, what you need to do is create a folder, say development under your user. Then type into the terminal cd development Then re-create the file there, then you should be in the directory in the terminal and it should work to run.

ok i created a folder on my desktop called development, and put a single item in it, then i typed cd development in the terminal and it says no such file or dir

ok i made the dev folder in my user file, and it showing in the terminal so check on that! yah.. ok so now, i do see that the teacher has a filed called ruby-examples and my file is development ok so we got step one done, how to proceed to step two? like i got the folder working { thanks to you guys } I'm gonna keep messing with this and try to ( get her done ) lol

success !! thanks guys I've got it working thanks to you all