The ruby programming starter checklist

Use this checklist in order. Tick each item before moving to the next. If an item takes more than 30 minutes, stop and fix the blocker rather than adding more code.

1. Run three checks before you write code

Install Ruby 3.2 or newer. Open a terminal and run these three checks:

  • ruby -v — the first line should begin ruby 3.
  • ruby -e 'puts 2 + 2' — the output should be 4.
  • irb — you should see an interactive prompt. Type exit to leave.

If any check fails, solve that before creating files. A version below 3.2 is workable for some tutorials but will cause avoidable confusion with newer examples. Keep a note of the exact version on screen; you will need it when a gem refuses to install. Allow 10–20 minutes for installation, including a terminal restart. Do not add a second version manager until one Ruby works.

2. Create one starter file and run it

Make a folder named ruby-starter. Inside it, create one file called hello.rb. Use a plain text editor and two-space indentation. Add one line:

puts "Hello from Ruby"

Save the file. In the terminal, move into the folder with cd ruby-starter, then run ruby hello.rb. You should see the greeting once. If the file opens in a word processor, save it again as plain text; curly quotes can break Ruby. Do not add a framework, a database, or a second file yet. One file that runs is the checkpoint.

3. Confirm five syntax basics

In irb or a scratch file, check that you can predict the result of these five moves:

  • puts "text" prints one line.
  • name = "Ada" stores a string.
  • "Hello, #{name}" inserts the value.
  • [1, 2, 3] creates an array; the first item is at index 0.
  • {name: "Ada", age: 36} creates a hash with two keys.

Change one value in each example and run it again. If the output matches your prediction, tick the item. If not, test the smallest part alone. This is faster than reading another chapter. Keep these five examples in a note; they are the vocabulary you will reuse in every starter script.

4. Write an 8–12 line script with input and output

Extend hello.rb so it asks for a name and an age, then prints a sentence. Keep the whole script between 8 and 12 lines. A suitable target is:

print "Your name: "
name = gets.chomp
print "Your age: "
age = gets.chomp.to_i
puts "Hello, #{name}. Next year you will be #{age + 1}."

Run it twice with different answers. gets.chomp removes the newline; to_i converts text to a whole number. If the script crashes, read the line number in the error and fix that line first. Do not rewrite the whole file. Run ruby -c hello.rb to check syntax without executing it; a clean file prints Syntax OK.

5. Spend 15 minutes testing in IRB

Open irb and test one expression at a time for 15 minutes. Try "a" * 3, [1, 2, 3].map { |n| n * 2 }, and 2 == 2. Change one number or string, then predict the result before pressing Enter. Type exit when the timer ends. If IRB shows => before a value, that is the return value, not necessarily printed output. This builds a habit: test a small piece, then put it in the file. Stop at 15 minutes; fatigue produces fake understanding.

6. Add one decision and one loop

Add an if/else to your script and one each loop over an array of at least three items. Use two-space indentation. Run the script with one input that should take the if branch and one that should take the else branch. Then check that the loop prints every item exactly once. If the loop prints nothing, confirm the array has items and that you used each rather than map when you only want output. If either check fails, reduce the code to the smallest failing example. Tick this item only when both paths run without an error.

7. Diagnose the first common failure

Symptoms: ruby hello.rb prints cannot load such file -- hello (LoadError), or the terminal returns to the prompt with no output. Likely causes: the terminal is in the wrong folder; the file is named hello without .rb; the filename has a typo; or you are running the command from an editor panel that is not a terminal. The fix: run pwd to see the current folder, run ls to list files, then cd ruby-starter and run ruby hello.rb again. Read the first error line and its line number before the last line. A LoadError is about finding the file; a NameError is about a missing variable or method. If ruby -v itself is not recognised, Ruby is not on your PATH; reopen the terminal, then reinstall with the option that adds Ruby to your PATH. Do not edit system files blindly.

8. Use Bundler for one gem, not ten

Only do this after a plain Ruby file runs twice without help. In ruby-starter, run bundle init. This creates a Gemfile. Add exactly one gem that you need for a small task, using the version constraint from its documentation, then run bundle install. A Gemfile.lock should appear. Run your script through Bundler with bundle exec ruby hello.rb. Run bundle list and confirm your one added gem is listed; remove extras from the Gemfile and run bundle install again. If installation fails, check the gem’s required Ruby version against your ruby -v output. Keep one gem until the script works; ten gems turn a starter checklist into a debugging project.

9. Tick the finish line

Your starter checklist is complete when all five statements are true:

  • ruby -v shows Ruby 3.2 or newer.
  • ruby hello.rb runs one file without help.
  • The script is 8–12 lines and uses input, output, one if/else, and one each loop.
  • ruby -c hello.rb prints Syntax OK.
  • bundle exec ruby hello.rb runs with exactly one gem in the Gemfile.

If one statement is false, return to the matching section rather than starting a new tutorial. A 20–30 minute session that ticks one item is better than a three-hour session that adds five unfinished files.

FAQ

Do I need Ruby installed before I create hello.rb?

No. You can create the file first, but you cannot run it until Ruby is installed. Install Ruby 3.2 or newer, reopen the terminal, and run ruby -v before ruby hello.rb.

How long should each checklist session take?

Use a 20–30 minute block. Spend no more than 15 minutes in irb, then move one working change into your file. Stop when one checklist item is ticked or one blocker is clearly identified.

What if ruby -v is not recognised after installation?

Close and reopen the terminal first. If it still fails, check that the installer added Ruby to your PATH. Reinstall with that option if needed. If the version still does not appear after 10 minutes, ask for help with the exact error text rather than changing system settings at random.