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

Life Dragon
Life Dragon
1,792 Points

How to write Ruby Code

How do you write ruby code on your own computer, not workspaces.

2 Answers

Jason Anders
MOD
Jason Anders
Treehouse Moderator 145,860 Points

Ruby can be written in any text editor. I use either Sublime or Atom (depending on my mood). If you are working on a Mac, Ruby is already installed and ready to go. If you're on Windows... yeah, a tad more complex.

You may want to have a look at Treehouse's workshops on installing/running a Ruby on Rails environment locally.

Installing .... on a Mac

Installing ... on a Windows

:dizzy:

As Jason said, you can create the files and edit them in a text editor (Ruby files are simply text files that end with .rb).

However, to RUN them you will need to install Ruby on your system - there are lots of tutorials on this if you Google for it.

Once you have Ruby installed and you have created a Ruby file you can, in your Terminal:

ruby my_ruby_file.rb

That will execute your Ruby file.

PS I secretly highly recommend you do this, rather than using Workspaces.