Skip to the workspace
Pebellslearn by building
Introduction and Setup  ›  Lesson

Package Managers and Installers

Package Managers 12 minAn installer or system package manager supplies a Ruby runtime. RubyGems manages Ruby libraries; these are different layers of a working Ruby environment.

ruby / Package Managers and Installers

Explore each scene at your own pace.

01 · The rule

The rule

Package Managers and Installers

An installer or system package manager supplies a Ruby runtime. RubyGems manages Ruby libraries; these are different layers of a working Ruby environment.

Separate the Ruby runtime from tools that install it and tools that manage gems.

You sit down to write the Bean Cart sales script, type ruby -v, and see a version from years ago, or "command not found". Before any code, you need a working, current Ruby. There are a few ways to get one, and picking the right one saves hours of confusion later.

The rule

Leave the system Ruby alone; install your own current Ruby.

Some operating systems include a copy of Ruby that their own tools rely on. On macOS it is old and marked as deprecated. If you install gems into it or try to upgrade it, you can break things or hit permission errors. So you add a Ruby of your own instead. You have three broad options:

  1. An operating-system package manager. Homebrew on macOS, apt on Debian and Ubuntu, dnf on Fedora. One command, and you get whatever version that package manager currently offers.
brew install ruby        # macOS with Homebrew
sudo apt install ruby-full   # Ubuntu or Debian
  1. A dedicated installer. Tools such as ruby-build and ruby-install download the Ruby source and compile the exact version you ask for. On Windows, RubyInstaller is the standard download, and its "with Devkit" build includes the compiler tools that some gems need.
ruby-install ruby 3.3.5
  1. A version manager, which usually uses an installer behind the scenes and lets you keep several versions side by side. That is the next lesson.

Whichever you choose, check the result:

ruby -v    # prints something like: ruby 3.3.5 (...) [arm64-darwin23]
which ruby # shows which ruby binary your shell will actually run
Scene 1 of 5
Hover to wake the cannons. Drag to move, or use arrow keys when focused. Press Enter to fire a shot.