Thuta Learning
BasicProgrammingbeginner

Get Started (Setup)

Relax. We'll talk through this in plain words — no textbook voice.

To run Ruby code on your local machine, you need a Ruby interpreter. On Windows, RubyInstaller makes this easy. On macOS/Linux, managing versions with rbenv or RVM is a cleaner approach.

ruby
# Check Ruby version
ruby -v

# Create a file named hello.rb
puts "Ruby is ready!"

# Run the file
ruby hello.rb

ruby -v checks whether Ruby is installed. If a version number shows up, Ruby is ready to go. .rb — write your Ruby code in a file with this extension, then run it from the terminal.

You should see
ruby 3.x.x Ruby is ready!

Info

Keeping spaces out of file names causes fewer errors for beginners. For example, write hello.rb, calculator.rb, and so on.

Easy traps

  • If you see a "command not found" error, it likely means Ruby isn't installed yet, or it's not on your PATH. Try closing and reopening the terminal.