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
Kelvin Knighton
6,168 PointsHe 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
William Baker
2,485 Pointsit 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.
Brandon Barrette
20,485 PointsI 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.
William Baker
2,485 PointsThats explained much better
William Baker
2,485 Pointsthat or cd desktop first then cd development Thats probably easier
Jonathan Smith
2,672 PointsAgreed!
William Baker
2,485 PointsYou 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
Jason Anello
Courses Plus Student 94,610 PointsI 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.
Kelvin Knighton
6,168 Pointsbut 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???
William Baker
2,485 PointsIs it still saying that there is no file or directory?
Kelvin Knighton
6,168 Points$ruby varible_intro.rb and the terminal returned 1 for him
Kelvin Knighton
6,168 Pointsyes
William Baker
2,485 PointsWhere did you create the file?
Kelvin Knighton
6,168 Pointstextmate
Kelvin Knighton
6,168 Pointshe saved this to his textmate file a = 1 puts a :: i understand that, but why not run in the terminal?
William Baker
2,485 PointsOK, 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.
Kelvin Knighton
6,168 Pointsok 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
Kelvin Knighton
6,168 Pointsok 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
Kelvin Knighton
6,168 Pointssuccess !! thanks guys I've got it working thanks to you all