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.

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.
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.
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.
git --version
gcc --version
make --versionThe 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.
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:
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-buildAdd 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.
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:
rbenv install 4.0.6
rbenv global 4.0.6
ruby -vThe 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 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:
irb
gem --version
gem list | head -5Inside 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.
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:
gem install bundler
bundle --versionAfter 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.
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.
Now it's time for a full verification. Create a project directory and your first Ruby file:
mkdir belajar-ruby
cd belajar-ruby
echo 'puts "Halo, Ruby #{RUBY_VERSION}"' > halo.rb
ruby halo.rbIf 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.
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:
rbenv install 4.0.6.ruby -v, gem --version, and bundle --version must all work.gem install bundler and will be used throughout the series.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!