Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Joshua Perry2,962 Points
I'm confused - Ruby in Sublime Text 2?
I'm very frustrated with how these courses do not seamlessly connect from one to the next. I'm on the Ruby track and I just completed "Installing a Ruby Environment" It took me a while, but I got everything up and running as laid out in the Mac version.
I now have Ruby 2.2.0 installed and I also installed the Virtual box, Sublime text, etc. Now I'm watching this course - and it's clearly back-tracking on stuff we already did (Install Ruby), but it's describing it in very different ways. I'm completely lost and frustrated.
Anyway, here is my question. Should I be doing these IRB exercises in the terminal or in sublime text 2?
If someone could please guide me - I'm a total beginner and am having difficulty connecting the dots.
Maciej Czuchnowski36,440 Points
Also: you do things in Sublime Text (or ANY other text editor, doesn't matter, Jason uses Sublime because he likes it) if they require a few lines of code. IRB is used mainly for executing a single line on the fly. You should also try Workspaces, doesn't require you to install anything: http://teamtreehouse.com/workspaces
Hey Joshua! I ran into this problem, too. I was extremely frustrated that we had just gone through a video series showing us exactly what to install and how to do it. Sublime Text 2 was recommended. Now, they're using an archaic version of TextMate.
I spent the better part of the day trying to figure this out and finally got it to work for me.
First, make sure your local bin directory exists. Type the following into your console:
The, copy and paste the following into the terminal:
sudo ln -s "/Applications/Sublime Text 2.app/Contents/SharedSupport/bin/subl" /bin/subl
It looks very similar to the other stuff, but there is a minor difference or two. Try pasting that in, hit enter. Nothing will happen, but no error message will come up either. Then, type 'subl' + the name of a new file you want to create. For example: subl new_file.rb
Note, it has to have the .rb tag on the end, so that it's recognized and created as a ruby file.
Once you've done that (and hopefully Sublime Text opened with your new file name), type in some basic ruby, like:
puts "Hello World"
Save the project with command + S (on mac, or equivalent on Windows)
Go back to your terminal and type in: ruby new_file.rb (or whatever you named your file)
You use the ruby command + whatever your file name is, ended with.rb
That should have printed out the result of your ruby code (Hello World, in the above example).
Hope this helps - let me know if it worked for you. These kind of problems can be really frustrating and deRAIL (pun intended) your work flow.
Best of luck! Pete