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
Jordan Pierre
16,723 PointsWhere should I be writing my ruby code?
Hello Everyone,
I am still in the beginning stages of ruby and I'm a little confused about where I should be writing my ruby codes. I some of the exercises I was writing code in irb on my console. And then sometimes the instructor switches to a text editor such as Sublime Text. Should I be writing my code in Sublime Text, Xcode, or irb?
6 Answers
Stone Preston
42,016 PointsXcode is used for mainly iOS and OS X development, not ruby (although I believe it is possible, maybe have a look at MacRuby). IRB is convenient, but writing more than one statement at a time gets kind of hairy. In my opinion IRB is really a learning tool, its not really designed to have large amounts of code written in it. I prefer just using sublime text
Miguel Hernández
Courses Plus Student 1,101 PointsIn mi opinion always text editor + terminal is the best option.
Justin Carlson
12,755 Points+1 for Sublime Text.
Justin Carlson
12,755 Pointssubl is a command line for sublime text. looks like its not installed or it is not sublime text 2 I think in 3 they changed the command line executable name.
Jordan Pierre
16,723 PointsThanks Justin, I did have the first version of sublime and not 2 or 3 installed. What does touch command mean? And I updated to Sublime 2 I still get the -bash: subl: command not found error message
Justin Carlson
12,755 PointsWell from the command prompt if you issue a "which subl". Does it come back with anything? Sounds like either it did not get installed of for some reason is not in your path.
Touch is a *nix command that creates and empty file or can be used to update the atime of a files attributes probably why it's called "touch" :-)
Michael Kuntz
5,815 PointsI've been using TextMate 2. I have it set up so I just type: mate file_name.rb and it will create the file and open it for me right away. P.S. This is all extremely new to me. I don't even remember how/why I ended up using TextMate instead of Sublime.
Jordan Pierre
16,723 PointsJordan Pierre
16,723 PointsThanks for the quick response. Now I have a follow-up question. I am working on the methods badge in ruby basics. The instructor typed in:
touch simple_methods.rb
and then
subl simple_methods.rb
I then got this message
-bash: subl: command not found
So Im assuming he did this to open and save a new ruby file. And I'm not sure why I got that error message but when I opened the file using my desktop, it opened as an Xcode file.