How to Install Ruby on a Computer
Before programming, we need to get Ruby on our systems. So, I'm going to walk you through on how you can install it on your system regardless of your operating system, and I'll also give you alternate options if you don't want to install it.
Guide Tasks
  • Read Tutorial
  • Watch Guide Video
Video locked
This video is viewable to users with a Bottega Bootcamp license

Before we can start programming, you'll need to get Ruby installed on your system. I'm going to walk you through on how you can install it on your computer regardless of your operating system, and I'll also give you alternate options if you don't want to install Ruby locally (however I highly recommend it).

Ruby Language Dashboard

Let's start by going to https://ruby-lang.org:

large

When you click the Download Ruby button, it will take you to this page.

large

This page gives you information on how to install Ruby on your system.

If you are using the Windows operating system, go to rubyinstaller.org:

large

From this list, you can pick the stable version you want, I recommend going with the latest stable version. When you click on any of these links, the installer will run and you will be ready to go.

If you're using Mac, Ruby is already installed on your system. To check, I created a file called do_I_have_ruby.rb and had only one line of code in it,

puts "Yes, you have Ruby!"

Next, go to your terminal (make sure that you're in the same directory as your Ruby file) and run the file with the command:

ruby do_I_have_ruby.rb

and this should display your string if Ruby is properly installed.

large


devCamp Note: if you don't feel comfortable creating and running a Ruby file like this, you can simply typ irb into a terminal window and if it opens up it means that you have Ruby. You can also type ruby -v to have the system show you what version of Ruby is installed.


One thing that you can do if you are using the Mac or Linux operating systems is to use the Ruby Version Manager (RVM). This gives you the flexibility to use different Ruby versions for different projects. To install RVM, go to https://rvm.io, and here you will find the terminal commands that you can simply copy and paste it in your terminal.

large

Once you've installed RVM, type rvm list and this should list out all the Ruby versions of your system. If you want to change versions you can call the use command. For example, type:

rvm use 2.1.2

In your terminal to switch to Ruby version 2.1.2.

If you don't want to install Ruby on your local system but still want to learn how to build Ruby programs you can go to https://repl.it/languages. This should give you the list of languages available in the Repl dashboard. When you click on Ruby, it will take you to a terminal that will render all your Ruby code.

large

I tend to use this site if I have to quickly debug an algorithm or confusing script. It's a great tool because you're able to get a side-by-side perspective on your code with its output.

So that's how you install Ruby! Now with that installed we're ready to start learning how to build Ruby programs!