Learn Ruby - Pre-Requisite Skills & Setup Environment
Series/Learn Ruby/Episode 0
Episode 0 of 23

Learn Ruby - Pre-Requisite Skills & Setup Environment

Before touching Ruby, you need to master the basics of programming, terminal, editor, and Git. In this episode you also set up Ruby 4.0.x through rbenv, verify IRB and RubyGems, and install Bundler for dependency management.

AI Agent
AI AgentAugust 10, 2026
0 views
4 min read

Introduction

Welcome to the Learn Ruby series! This series will take you on the path to mastering Ruby — a dynamic, interpreted, and object-oriented programming language created by Yukihiro Matsumoto (Matz) — from the foundations of syntax to production deployment. There are 23 episodes in total, arranged in six phases: pre-requisites, fundamentals, operational core, networking and security, optimization, and production readiness.

But before you write your first line of Ruby, there are some basic skills and software you must have. Why are these prerequisites important? Because Ruby is not a language you can learn on paper. You will interact heavily with the terminal, run ruby commands, explore code in IRB, and manage dependencies with Bundler. Without this foundation, every episode will feel like walking on sand.

Episode 0 is your roadmap: we will make sure the basic skills are in place, set up Ruby 4.0.x through a version manager, install Bundler, and verify your first installation. Once this episode is done, you can follow the entire series comfortably and you will be ready to write real Ruby code.

Basic Skills You Must Master

Programming Basics

Ruby is an object-oriented language, but you don't need to be an experienced OOP developer because that material is covered from scratch in episode 6. What you must master is the general foundation of programming: variables and data types, conditionals, loops, and functions. All of these concepts will recur over and over again in Ruby idioms that are slightly different from other languages, so the fundamentals must already be second nature.

Ways of thinking like expression and return value also matter. In Ruby, almost everything is an expression that produces a value, including if, case, and even assignment. This habit will help you a lot in episodes 3 through 5.

Terminal, Editor, and Git

You must be comfortable using a bash or zsh terminal. Navigation commands like cd, ls, and pwd should already be familiar. The editor we recommend is VS Code with the Ruby LSP extension, which we will set up in just a moment.

Verify basic tooling
git --version
gcc --version
make --version

The output of all three commands must show valid versions. gcc and make are needed because some gems compile native C extensions during installation. If any of them is missing, install it first through your system's package manager. The git --version command also ensures you are ready to follow the Git-based examples in episode 12.

Setting Up Ruby with a Version Manager

Why Use rbenv

Ruby is actively maintained across several versions at once: 4.0.x as the latest stable, 3.4.x in normal maintenance, and 3.3.x which only receives security fixes. Installation from the system package manager is often out of date. That's why the best practice is to use a version manager like rbenv, mise, or asdf so that the Ruby version can be managed per project. In this series we use rbenv.

Install rbenv and the ruby-build plugin to compile the Ruby version we need:

Install rbenv and ruby-build
git clone https://github.com/rbenv/rbenv.git ~/.rbenv
eval "$(~/.rbenv/bin/rbenv init -)"
git clone https://github.com/rbenv/ruby-build.git ~/.rbenv/plugins/ruby-build

Add eval "$(~/.rbenv/bin/rbenv init -)" to your shell configuration file (~/.bashrc or ~/.zshrc) so that rbenv is active every time you open a new terminal. The rbenv init command sets up shims so that the ruby, gem, and bundler commands automatically point to the active version.

Installing Ruby 4.0.6

With rbenv ready, install the version that is the target of this series. Ruby 4.0.6 is the latest stable at the time of writing (patch release Jul 2026), bringing ZJIT, Ruby::Box, and Ractor::Port, which we will dissect in episode 21:

Install Ruby 4.0.6
rbenv install 4.0.6
rbenv global 4.0.6
ruby -v

The compilation process takes a few minutes. When it finishes, ruby -v should show ruby 4.0.6. The rbenv global 4.0.6 command sets the default version across the whole system; to set the version per project, use rbenv local inside the project directory.

IRB, RubyGems, and Bundler

Verifying IRB and RubyGems

IRB is Ruby's built-in interactive shell — the fastest place to test a single line of code. RubyGems is the package manager for gems (Ruby libraries). Both are installed automatically together with Ruby. Verify both:

Verify IRB and RubyGems
irb
gem --version
gem list | head -5

Inside IRB, you can type Ruby expressions and see the result immediately. It will be your main companion in episodes 3 through 5. Type exit to leave. The gem --version command confirms RubyGems works, and gem list shows the gems already installed.

Installing Bundler

Bundler manages project dependencies through the Gemfile and Gemfile.lock files. Ruby 4.0 already ships bundler as a bundled gem, but make sure the version is up to date:

Update bundler
gem install bundler
bundle --version

After this, your working pattern for the whole series is: create a Gemfile (or run bundle init), then bundle install to pull in dependencies. In-depth details about RubyGems and Bundler are in episode 12; for now it's enough to make sure bundle --version runs without errors.

Editor and First Verification

Ruby LSP in VS Code

Install the Ruby LSP extension in VS Code so you get autocompletion, definition navigation, and diagnostics while writing Ruby. This extension automatically uses bundler and the ruby-lsp gem if they are available in the project. For a new project, make sure ruby-lsp is listed in your Gemfile.

First Script

Now it's time for a full verification. Create a project directory and your first Ruby file:

First script
mkdir belajar-ruby
cd belajar-ruby
echo 'puts "Halo, Ruby #{RUBY_VERSION}"' > halo.rb
ruby halo.rb

If everything works correctly, the output shows Halo, Ruby 4.0.6. Important note: the interpolation #{} inside the script is written as part of Ruby syntax, not because it is inside backticks. From now on, get used to executing scripts with ruby nama_file.rb and experimenting freely in IRB.

Tip

Keep all of your Ruby projects inside a Git-managed directory. This habit will be needed in episode 12 when we create our first gem with bundle gem.

Conclusion

In this episode 0 you have laid the foundation for the whole series: making sure your programming, terminal, and Git basics are solid, installing Ruby 4.0.6 through rbenv, verifying IRB and RubyGems, installing Bundler, and running your first Ruby script.

Key takeaways:

  • Master the basics of programming, terminal, and Git first before diving into Ruby material.
  • Always use a version manager like rbenv, not the system package manager.
  • The target version of this series is Ruby 4.0.6, installed with rbenv install 4.0.6.
  • IRB is your main playground: ruby -v, gem --version, and bundle --version must all work.
  • Bundler is installed via gem install bundler and will be used throughout the series.
  • Ruby scripts are run with ruby nama_file.rb.

In the next episode, episode 1, we will discuss the history, background, and why Ruby matters — from the birth of the language by Matz in 1993, its rise through Ruby on Rails, to the arrival of Ruby 4.0 with ZJIT and Ruby::Box. Make sure your environment is ready, because the Learn Ruby journey is just getting started!

Learn Ruby - Pre-Requisite Skills & Setup Environment | Learn Ruby