How To Install Homebrew, Ruby, and gems On Apple Silicon Macs (M1/M2)

Updated

When the first M1 Macs were released in late 2020, Homebrew and other development tools were not quite ready to run in native mode with the Apple Silicon chip ARM architecture. Today, that is no longer an issue for modern Ruby development.

Unfortunately, you will still find many outdated blog posts and people who still recommend using Rosetta, or running commands with arch -x86_64, or making changes to your shell file to set the architecture. In 2025, the only reason to use Rosetta is to install Ruby versions 2.5.9 or older.

Homebrew installs things in a different directory when in native mode (/opt/homebrew) versus /usr/local in Rosetta mode (or when using the arch -x86_64 command). So, it’s easy to get confused and run into issues if you launched Terminal in native mode but started running some commands with arch -x86_64 and others without. Or if you launched Terminal in Rosetta mode and then tried to work with things that expected native mode.

This can lead to all kinds of issues, such as incompatible architecture and failed to load command errors, such as this one:

bundler: failed to load command: jekyll
incompatible architecture (have x86_64 need arm64e)

or ld: symbol(s) not found for architecture x86_64 and “ld: symbol(s) not found for architecture arm64”.

Another reason many people run into issues with Ruby on Apple Silicon Macs is because they’re trying to use the version of Ruby that came preinstalled on macOS, known as the system Ruby. If you run which ruby in your terminal, and if it says /usr/bin/ruby, that’s the system Ruby and you definitely don’t want that. Learn why you shouldn’t use the system Ruby.

Instead, I recommend using a version manager to install a separate and newer version of Ruby. Popular version managers include asdf, chruby, rbenv, and rvm. I personally recommend chruby and ruby-install. Read my step-by-step guide for properly installing Ruby on a Mac.

If you’re already using a Ruby version manager, and you’re running into issues installing Ruby or gems like Rails, Jekyll, ffi, sqlite, mysql2, sassc, and cocoapods, then I recommend trying again in native mode and making sure you’re not using Rosetta.

How to tell if you’re using Terminal in Rosetta mode

Launch Terminal, or whatever app you’re using to interact with the command line, then run this command:

uname -m

If it says x86_64, you’re using Rosetta. If it says arm64, you’re good to go.

How to turn off Rosetta mode

  1. Quit Terminal and any other app that uses the terminal (such as iTerm, VS Code, Sublime Text).

  2. Go to the Finder

  3. Go to the Utilities folder by pressing shift-⌘-U (or select “Go” from the menu bar, then select Utilities)

  4. Click once on the Terminal app to select it, but don’t launch it.

  5. Press the ⌘-i keyboard shortcut to open the Info window (or from the menu bar: “File”, then “Get Info”).

  6. Make sure the “Open using Rosetta” checkbox is unchecked.

  7. Close the info window

  8. Launch Terminal

  9. Run uname -m and verify that it says arm64

  10. Run arch and verify that it says arm64

You should also check these files for any mention of arch -x86_64, i386, ARCHFLAGS or other lines that look like they’re setting the Intel architecture. Then remove them, or comment them out:

Then quit and restart your terminal app.

Still having issues after turning off Rosetta?

If you’re running in native mode and still having issues installing Ruby itself, or installing and using Ruby gems, then the first thing I would check is that you’re using updated Ruby and gem versions. If you have a proper Ruby dev setup, you should be able to install Ruby 3.3.8 and 3.4.5 without any issues.

You should also be able to create a brand new Rails app or create a brand new Jekyll site using the latest version of those gems. If that works, but running bundle install in your older projects fails to install some gems, then the most likely issue is that the gems are outdated. You can check by running bundle outdated. The first thing I recommend is to update your gems.

To be able to install a gem on Apple Silicon, it has to support the ARM architecture. Since the first M1 Macs didn’t come out until late 2020, most gems released before that will not work on Apple Silicon. Now that we’re in 2025, most popular gems have been updated to work on M1/M2 Macs, so you’ll need to install the latest versions.

For example, one issue you might run into if you have an existing Ruby project with an older version of the ffi gem, is an error saying failed to load command and then a more specific error like this one:

~/.gem/ruby/2.7.2/gems/ffi-1.13.1/lib/ffi/types.rb:69:in `find_type': 
unable to resolve type 'size_t' (TypeError)

The solution is simple:

bundle update ffi

For Rails and Jekyll projects, you might need to update both ffi and sassc at the same time:

bundle update ffi sassc

Keep updating gems that fail to install until bundle install succeeeds.

If you still can’t install Ruby or the latest version of gems that are known to work on Apple Silicon, then that means your dev setup is broken and needs to be completely cleaned up, which can involve around 60 steps that can take an hour to run.

This is where Ruby on Mac can save you a ton of time. It has a “reset” mode that can safely back up and clean up your dev setup in less than 1 minute, and then you can run it in “normal” mode to reinstall everything you need from scratch in less than 15 minutes.