gifPaper for Mac
Guide

Installing Ruby on Mac: Every Method That Actually Works

· 13 min read

You open Terminal on a fresh Mac, type ruby -v, and the machine cheerfully hands you a Ruby version you didn't ask for. Then gem install throws a permission fit, because the computer is doing exactly what it was told, just not what you meant.

That's the whole trick with installing Ruby on Mac. The goal isn't to fight the Ruby that ships with macOS, it's to install a Ruby I control, one that won't wobble the next time Apple updates the operating system or a project decides it wants a newer interpreter.

The Ruby Situation on a Fresh Mac

A new Mac comes with a system Ruby, and that part is intentional. Apple uses it for parts of the operating system, so it's there before you ever touch a terminal. The problem is that modern development work usually needs a different Ruby, one pinned to a specific release so a team can reproduce the same behavior on every machine, which is why version managers became the default path in the first place. The macOS guides in the wild keep circling back to the same logic: install a managed Ruby, leave the system one alone, and avoid the kind of permission mess that shows up after a well-meaning sudo spree. Switching from Windows to Mac can be oddly familiar in this respect, because both worlds punish the habit of trusting whatever the box gave you by default.

Gears
The machinery of version control—at least this kind spins without complaints
Get this wallpaper

Why the system Ruby is not the one you want

The system interpreter exists, but it's not the right place to build a working development setup. Older Ruby versions are fine for the OS, not for your Rails app, your gemset, or that project someone swore would "just work" on Monday and now won't boot on Friday. The safe pattern is to keep Apple's Ruby untouched and install a separate one through a version manager, so your shell points at the interpreter you picked instead of the one macOS happened to ship.

Practical rule: if a command wants to alter the system interpreter, walk away and use a version manager instead.

That advice sounds fussy until you need one project on 3.1.x and another on 3.3.x. Without isolation, switching between them gets messy fast, and the fix usually involves more terminal archaeology than anyone wants before coffee.

Why version managers win

Version managers solve two problems at once. They let you install multiple Ruby versions and they let you switch cleanly between them, either globally or per project. That's the key value, not convenience for its own sake, but reproducibility across teams, machines, and Apple Silicon setups where shell config matters more than people expect.

If you've ever inherited a repo and found a .ruby-version file, that's the whole philosophy in one tiny text file. It says, "use this Ruby here," and your shell agrees. That's far better than guessing what the previous developer had installed when they last pushed code from a laptop with three stickers and a dying battery.

Five Methods Compared at a Glance

There are five realistic ways to handle Ruby on macOS, and only two of them deserve to be the default conversation. System Ruby is a bad idea for development, Homebrew Ruby is fine for quick experiments, rbenv is the standard pick, RVM is the older tradition, and asdf or Mise makes sense when Ruby is only one language in a larger toolbox. Current macOS installation guides keep converging on Homebrew plus rbenv plus ruby-build, while newer troubleshooting advice is pointing at Mise or rv when you want to sidestep source builds altogether.

Method Isolation model Build time Best for
System Ruby None, it's the OS copy None Not development, unless you enjoy regret
Homebrew Ruby Separate package, but still a single active install Moderate One-off scripts, casual use
rbenv Per-shell shims and version selection Noticeable, because Ruby is compiled from source Most Mac developers
RVM Shell functions and wrapper-based switching Noticeable Older projects and existing RVM setups
asdf or Mise Multi-language version manager with project files Varies, often lighter with newer tooling Teams managing Ruby plus Node, Python, or other runtimes

What the comparison actually means

rbenv wins for many developers because it stays out of the way. It doesn't replace your shell, it doesn't try to own every language on the machine, and it does one job well. RVM still works, but it's the older habit, and that extra shell magic can clash with Homebrew in ways that feel unnecessarily theatrical.

asdf and Mise are the practical choice if Ruby is only part of the setup. If you're juggling Node, Python, or Elixir too, one tool and one project file can be easier than three separate version managers pretending not to know each other. Mise is especially interesting because the newer guidance around it leans on precompiled binaries, which means less waiting around for a source build to finish its little ceramic-horse routine.

If you only need Ruby, rbenv is usually the cleanest path. If you need a whole stack, asdf or Mise starts looking less like a compromise and more like a sane adult decision.

The Default Path with Homebrew and rbenv

The workhorse setup starts the way most current guides do, with Homebrew, then rbenv and ruby-build, then a shell reload before any Ruby install happens. The reason this workflow keeps winning is simple: it isolates Ruby versions and avoids overwriting the system Ruby that macOS already uses. The common sequence is brew install rbenv ruby-build, rbenv init, install the target Ruby, set it globally, then verify with ruby -v. One guide notes that a stable Ruby release in October 2024 was 3.3.5, which is a good reminder that Ruby installs are version-specific, not vibes-based. A separate guide shows the same pattern with rbenv initialization and version pinning.

A person using a MacBook laptop to install Homebrew with a large red ruby icon displayed.
A person using a MacBook laptop to install Homebrew with a large red ruby icon displayed.

The install sequence that usually works

Start with Homebrew if it isn't already on the machine. Then install the version manager and the build plugin together, because rbenv without ruby-build is like a kitchen with no stove.

  1. Install the tools. Run brew install rbenv ruby-build.
  2. Initialize rbenv. Add the eval "$(rbenv init -)" line to your shell config, usually ~/.zshrc.
  3. Reload the shell. Close Terminal and open a fresh window so the new config loads.
  4. Install a specific Ruby. Use rbenv install 3.3.5 or whatever version your project wants.
  5. Set the default. Run rbenv global 3.3.5.
  6. Verify it. ruby -v should report the version you just installed.

That order matters more than people think. Several installation guides note that the process may take a while, because Ruby is compiled from source rather than copied into place. That pause isn't a failure, it's the build doing honest labor.

The Apple Silicon snag nobody enjoys

The most common breakage on modern Macs isn't the install command itself, it's the shell. On Apple Silicon, /opt/homebrew/bin has to be early in the path, and rbenv init has to be loaded in the shell session you're using. If you edit ~/.zshrc and then immediately run rbenv install in the same terminal without reloading, the terminal can keep resolving the old system Ruby and make you question your profession.

A practical habit helps here. Open a new terminal window after editing your config, then check rbenv -v and ruby -v before you trust anything else. One troubleshooting guide also recommends checking the shell wiring with rbenv-doctor or brew doctor, which is a lot more polite than staring at a broken build and hoping it apologizes.

You Can Do The Thing!
Yes, you can do the thing. Even the terminal thing.
Get this wallpaper

RVM, asdf, and the Newer Alternatives

RVM still has a place, mostly because older tutorials used it everywhere and plenty of legacy setups still depend on it. It works, but it tends to be more opinionated about your shell, and the wrapper behavior can collide with Homebrew in ways that make a clean setup harder than it needs to be. Current older guides still show the classic path: install OpenSSL, point RVM at it, then install a specific Ruby and make it default. That path exists for a reason, especially if you're maintaining an older project that already assumes RVM is there.

When RVM makes sense

RVM is the right answer when the project already uses it. Migrating a live codebase from one version manager to another just to satisfy a philosophical preference is a fine way to spend a weekend and learn nothing useful. If the repo's docs say RVM, use RVM, keep the environment stable, and move on with your life.

When asdf or Mise is the better move

asdf and Mise are better when Ruby is only one language in your stack. They use project files like .tool-versions, so Ruby, Node, Python, and friends can share the same versioning pattern. That's a decent quality-of-life improvement if you're hopping between apps and don't want three separate tools negotiating over your shell like minor nobles at a bad banquet.

Mise has become especially interesting because newer guidance recommends it when you want to avoid source build pain. That's the part that matters on Apple Silicon, where compile-time friction can turn an otherwise normal setup into an evening project. If a tool ships precompiled binaries, that's not marketing fluff, that's fewer chances for OpenSSL, PATH, or stale build definitions to ruin your mood.

Good rule of thumb: if you manage one language, keep it simple with rbenv. If you manage a stack, use one tool that understands the whole stack.

After Install, Gems, Bundler, and Environment Variables

Once ruby -v prints the version you meant to install, the setup isn't finished, it's just become useful. The next common step in current guides is gem install bundler, because Bundler lets you manage project gems cleanly without reaching for sudo. That's the important boundary: Ruby is installed, but your project dependencies still need a sane, repeatable place to live.

What to do right after the version check

bundler is the first gem worth installing because it turns a raw interpreter into a working project environment. From there, the usual pattern is to keep the Ruby version pinned in the project and let the shell switch automatically when you cd into the directory. With rbenv, that means creating a .ruby-version file, or using rbenv local <version> to write one for you.

A clean setup looks like this:

  • Install Bundler: gem install bundler
  • Pin the project version: rbenv local 3.3.5
  • Confirm the file exists: check for .ruby-version in the repo
  • Verify the runtime: ruby -v inside the project directory

That little file is doing more work than it looks like. It stops the "works on my machine" conversation before it starts, because the repo itself now carries the version choice.

When to touch GEM_HOME and PATH

Most setups don't need custom GEM_HOME or extra PATH surgery after rbenv is working. The version manager already provides the right shims, which is exactly why people use it. Only reach for environment variables if you've got a weird legacy workflow or a build system with unusual assumptions, and even then, keep the change local and documented.

A quick smoke test helps too. Create a one-line hello.rb, run it from the terminal, and make sure the interpreter can execute a file instead of just answering -v politely. That's the difference between "installed" and "usable."

When the Install Fails, Diagnose Before You Re-Install

Most Ruby install failures on Mac aren't mysterious, they're boring in the exact way infrastructure failures are always boring. The three usual culprits are PATH and shell initialization, OpenSSL, and stale ruby-build definitions. If your machine also feels like it's dragging while you troubleshoot, this practical Mac cleanup guide is worth a look, because a sluggish system can make terminal debugging feel worse than it is. You can also keep an eye on the machine itself with this Mac performance guide.

A close-up of a laptop terminal displaying a command not found error with a magnifying glass.
A close-up of a laptop terminal displaying a command not found error with a magnifying glass.

The four checks that catch most problems

Before reinstalling anything, run through the basics.

  • Check the shell config. Confirm rbenv init or the Homebrew path is in ~/.zshrc or ~/.bash_profile.
  • Reload the session. Close Terminal, open it again, and verify the new shell properly picked up your config.
  • Check OpenSSL. If the build complains about SSL headers, install OpenSSL with Homebrew and use the right compile flags.
  • Check ruby-build freshness. If a brand-new Ruby release says the definition can't be found, upgrade ruby-build.

That sequence catches most "I followed the instructions and it still failed" moments. The shell can keep pointing at the system Ruby even when the install itself succeeded, which is why the terminal session refresh matters so much.

Why modern Macs break in familiar ways

Apple Silicon adds one more wrinkle, because the Homebrew prefix differs from older Intel setups. If /opt/homebrew/bin isn't early in PATH, the shell may find the wrong ruby, gem, or shim and pretend everything is fine until you try to install a gem. Newer troubleshooting advice also points out that some failures are just source-build pain, not user error. In those cases, a newer tool like Mise, or another precompiled-binary approach, can save you from wrestling with the compiler just to get to a usable interpreter.

If a setup repeatedly fails after the shell is correct, stop blaming yourself and inspect the environment. That's usually where the core issue resides.

Common Questions After You're Up and Running

How do you uninstall a Ruby version cleanly

If rbenv turned out not to be your thing, remove the version with rbenv uninstall <version>. Then delete the rbenv init line from your shell config so the shims stop loading every time you open Terminal.

After that, reopen the shell and check ruby -v again. If the system Ruby shows up, that's expected, because you've told rbenv to step aside.

How do per-project Ruby versions work

Use .ruby-version in the project directory, or run rbenv local <version> to write it for you. When you cd into that folder, rbenv reads the file and switches the interpreter automatically.

That setup is the cleanest way to keep one repo on one Ruby and another repo on a different one. It saves a lot of head-scratching when a teammate says, "It works here," and they're not lying.

What does gem command not found usually mean

Most of the time, it means the shell hasn't reloaded since the install. The PATH still points at the system Ruby, so the shell can't see the new gem executable yet.

Close Terminal, open a new session, and run ruby -v plus which ruby if you need to confirm what the shell is using. If you're still stuck, re-check the init line in your shell config. An older MacBook can make this whole dance feel slower than it should, so a lightweight machine checkup can help.


If you want a calmer Mac setup after all this terminal wrestling, take a look at gifPaper. It gives your lock screen and desktop something better to stare at than a blinking cursor, and frankly your Mac's been through enough.

Lofi Cat Study Companion
Your Ruby installation companion—judging your PATH errors in real time
Get this wallpaper