8 mins read

How to Update Ruby Version in Mac

Learn how to install the latest Ruby version on Mac, manage multiple versions, and avoid common issues.
Blog Image

Raisa Kanagaraj

Technical Content Writer

Blog Image

Overview

If you’re working on Ruby projects in macOS, it’s crucial to ensure your development environment is using an up-to-date version of Ruby. This guide will walk you through exactly how to update Ruby on Mac, step-by-step, whether you're working on new projects or trying to revive legacy code.

Introduction to Updating Ruby

Whether you’re building a new Rails application or maintaining a legacy Rails app, knowing how to update Ruby version in Mac is a critical skill. Ruby evolves with new features, bug fixes, and performance enhancements, typically released annually around December.

For instance, Ruby 3.4.1, released in December 2024, brought improvements like a better interactive Ruby interpreter (IRB) and enhanced developer tooling. Updating Ruby on Mac ensures your development environment stays current, secure, and compatible with modern gems and frameworks like Rails.

Let’s dive into why developers often struggle with old Ruby projects and how to update Ruby version on Mac OS effectively.

Why You Might Be Stuck with an Old Ruby Version

Many Mac users get stuck with the system-installed version of Ruby that ships with macOS. It’s outdated, and macOS restricts making changes to it, especially on newer Mac hardware like Apple Silicon (M1, M2, M3). For example, older versions like Ruby 2.7.0 may fail to compile on Apple Silicon due to compatibility issues with libraries like OpenSSL.

This creates problems when working on modern Rails apps, especially if you're trying to upgrade to Rails 7 or 8.

Additionally, some teams avoid updates due to:

  • Fear of breaking legacy code
  • Compatibility issues with gems
  • Inconsistent local environments

But staying on the older version means you miss out on new features, performance boosts, and important security patches.

The Importance of Keeping Ruby Updated on Mac

Updating your Ruby version on Mac OS is about more than just accessing new features. Here’s why it matters:

Security: Older Ruby versions, especially those past their end-of-life (EOL), may have unpatched security vulnerabilities. Sites like endoflife.date can help you check if your version is still supported.

Performance: Newer Ruby versions, like 3.4, offer speed improvements and better developer tools, boosting productivity.

Compatibility: Modern gems and frameworks, such as Rails, often require newer Ruby versions. For instance, Rails 5.0 and later needs Ruby 2.2.2 or higher.

Future-Proofing: Staying current ensures your projects are ready for new macOS updates and hardware changes, like Apple Silicon.

By following the steps below, you’ll learn how to update Ruby on Mac and keep your development environment in top shape.

Step-by-Step Guide to Update Ruby on Mac

Here’s a clear, up-to-date process to update Ruby version in Mac, including installing Ruby and Rails on Mac for a seamless development setup.

Set Up Xcode Command Line Tools

Before you update Ruby on Mac, you need Xcode Command Line Tools, which provide essential compilers and libraries. To install them, open your Terminal and run:

Xcode Select.png

Follow the prompts to complete the installation. This step ensures your Mac has the tools needed to compile Ruby and its dependencies.

Install Homebrew for Easy Package Management

Homebrew is a popular package manager for macOS that simplifies installing software like Ruby. To install Homebrew, run:

bin bash.png

After installation, verify it with:

Brew doctor.png

Homebrew makes it easier to install Ruby and Rails on Mac and manage dependencies, but it only supports one Ruby version at a time. For multiple versions, we’ll use RVM.

Add GPG for Secure Installations (RVM Only)

RVM, a Ruby version manager, requires GPG to verify installation packages. Install GPG via Homebrew:

brew install.png

Then, import the RVM keys:

rvm key.png

This ensures secure installation when you update Ruby version on Mac OS.

Method 1: Install Ruby Using RVM

RVM (Ruby Version Manager) lets you install and switch between multiple Ruby versions. Install RVM with:

rvm install.png

Add RVM to your shell by adding this to your ~/.zshrc or ~/.bash_profile:

Add RVM to profile.png

Verify RVM is installed:

rvm version.png

RVM is a powerful tool for developers who need to update Ruby on Mac and work on projects with different version requirements.

Now, you’re ready to update Ruby version on Mac. Check available Ruby versions with:

rvm list known.png

To install the latest version (e.g., Ruby 3.4.4 as of June 2025), run:

rvm install 3.4.4.png

Set it as the default version:

rvm use 3.4.4.png

Verify the installation:

ruby-v.png

You should see something like ruby 3.4.4p1 (2025-05-14 revision ...).

3.2 Method 2: Install Ruby Directly with Homebrew

For a simpler approach to update Ruby version on Mac, use Homebrew directly.

Install Ruby with:

brew install ruby.png

Homebrew installs the latest stable Ruby version (e.g., 3.4.1). Add Homebrew’s Ruby to your PATH by adding this to your ~/.zshrc or ~/.bash_profile:

echo path.png

Verify the installation:

ruby-v.png

Homebrew is great for single-version setups but doesn’t support easy switching between multiple Ruby versions.

3.3 Method 3: Install Ruby Using rbenv

rbenv is another lightweight version manager to update Ruby on Mac. Install rbenv via Homebrew:

brew install rbenv.png

Initialize rbenv by adding this to your ~/.zshrc or ~/.bash_profile:

echo eval.png

Check available Ruby versions:

rbenv install.png

Click this link to find out how to check ruby version on any system

Install the latest version (e.g., Ruby 3.4.1):

rbenv install 3.4.1.png

Set it as the global version:

rbenv global 3.4.1.png

Verify with:

ruby-v.png

rbenv is a lightweight alternative to RVM, ideal for developers who want simplicity when they install Ruby and Rails on Mac.

Congratulations, you’ve successfully learnt all the 3 methods to update Ruby on Mac.

When Should You Update Your Ruby Version?

Deciding when to update Ruby version on Mac depends on your project’s needs:

New Projects: Always use the latest Ruby version for new projects to leverage performance improvements and modern features.

Existing Projects: Check your project’s Gemfile and .ruby-version files for the required Ruby version. If it’s outdated, test compatibility with a newer version using a tool like RailsUp, which checks Rails and gem compatibility.

Security Updates: If your Ruby version is EOL (e.g., Ruby 2.7 reached EOL in March 2023), update immediately to avoid security risks.

Team Collaboration: Align with your team’s Ruby version to ensure consistency across development environments.

For older projects, you might need to install a specific Ruby version first (e.g., 2.7.8) to get the project running, then gradually update to a newer version. Always test updates in a development environment first.

Wrapping Up

Updating Ruby on Mac is straightforward with the right tools and steps. By installing Xcode Command Line Tools, Homebrew, GPG, RVM, and the latest Ruby version, you can keep your development environment secure and efficient. Tools like RailsUp help ensure your Rails projects remain compatible during upgrades.

Whether you’re installing Ruby and Rails on Mac for a new project or updating an old one, staying current with Ruby versions enhances performance, security, and compatibility. Follow this guide to update Ruby on Mac and keep your projects running smoothly.

Frequently Asked Questions

How do I update Ruby on a Mac? To update Ruby on Mac, install Homebrew, then use a version manager like RVM. Run rvm install 3.4.4 to install the latest version and set it as default with rvm use 3.4.4 --default. You can also install Ruby directly with homebrew or using rbenv.
How do I find my Ruby version on a Mac? Open Terminal and type: ![ruby-v.png](https://dev-strapi.sedintechnologies.com/uploads/ruby_v_5a51fa8316.png) This will display your current Ruby version.
How do I find all the Ruby versions? With RVM, you can run: ![rvm list known.png](https://dev-strapi.sedintechnologies.com/uploads/rvm_list_known_4b488ac46b.png) This will show all Ruby versions available for installation.
Should I also upgrade my gems when I upgrade Ruby? Yes. After you update Ruby version on Mac, it’s a good idea to update your gems to ensure compatibility. Tools like RailsUp can help verify which gems are ready.
Should I always upgrade to the latest version of Ruby? Not always. Make sure the version is stable and compatible with your project dependencies.

Written by Raisa Kanagaraj

Your one-stop shop for expert RoR services

Join 250+ companies achieving top-notch RoR development without increasing your workforce.

Book a 15-min chat