A step-by-step guide to installing Ruby on macOS, Linux, and Windows. Learn multiple methods including Homebrew, rbenv, RVM, and RubyInstaller.
Tutorial series
Ruby Fundamentals
16 tutorials — follow in order for the best learning path.
- Installing Ruby on Your Computer
- Getting Started with Ruby
Write your first Ruby program and learn the fundamentals of the Ruby programming language in this beginner-friendly tutorial.
- Ruby Basics: Variables, Types, and Operators
Learn how to store and manipulate data in Ruby with variables, understand Ruby's data types, and master operators for expressions.
- Control Flow: if, unless, loops
Learn how to control the flow of your Ruby programs with conditionals and loops. Master if, unless, case, while, until, and iterators.
- Defining and Calling Methods in Ruby
Learn how to define, call, and use methods in Ruby to organize your code into reusable blocks.
- Working with strings in Ruby: a complete tutorial
Create, format, and manipulate strings in Ruby. Covers literals, interpolation, methods, mutation, encoding, and the most common patterns you'll need.
- Working with arrays in Ruby: a beginner tutorial
Work with arrays in Ruby: creation, indexing, slicing, mutation, iteration with each and map, set operations, and common Enumerable patterns.
- Hashes in Ruby
Learn how to use hashes in Ruby to store and organize data with key-value pairs. This tutorial covers creating, accessing, modifying, and iterating over hashes.
- Blocks and Iterators in Ruby
Learn how to use blocks, iterators, and yield in Ruby to write expressive, reusable code that powers everything from simple loops to complex data processing.
- Classes and Objects in Ruby
Learn how to define classes, create objects, use initialize, instance variables, and accessor methods in Ruby.
- Modules and Mixins
Learn how to use Ruby modules as namespaces and mixins to share behavior across classes. Includes practical examples of the include and extend keywords.
- Error Handling with begin/rescue
Learn how to handle errors gracefully in Ruby using begin, rescue, ensure, and raise. Build robust programs that recover from unexpected situations.
- File I/O in Ruby
Learn how to read from and write to files in Ruby. Covers File, IO, FileUtils, reading line-by-line, writing, and best practices for handling files safely.
- Methods in Ruby
Learn how to define, call, and customize methods in Ruby — from basic syntax to keyword arguments, visibility, and idiomatic conventions.
- define_method in Ruby
Learn how to dynamically define methods at runtime using Ruby's define_method, with practical examples and real-world patterns.
- Variables and Types in Ruby
A practical tour of Ruby's five variable scopes, the core type hierarchy, runtime type checking, duck typing, and type conversions.