Error running '__rvm_make -j8' on macOS

Published by Moncef Belyamani on
Updated on

If you’ve been getting an error like “Error running ‘__rvm_make -j8’” while trying to install Ruby on a Mac with RVM (for example, rvm install 3.2.2), you’re not alone. Every day, hundreds of people struggle to install Ruby on macOS.

If you’re in a hurry and want to get unstuck right away, skip to the solution. If you’d like a deeper understanding of why this is happening, keep reading.

There are variations of this error, with a different number after the -j. For example:

Error running '__rvm_make -j16'
Error running '__rvm_make -j12'
Error running '__rvm_make -j4'

The number has nothing to do with the error. It represents how many cores your Mac has. More powerful Macs will have a higher number. The more cores that are used, the faster the Ruby installation can run. By default, RVM will try to compile Ruby using all the available cores on your Mac.

These types of errors happen frequently because there are many factors that can affect Ruby installation on a Mac. Here are a few of them:

  • The version of Xcode/Command Line Tools that’s currently installed
  • macOS version
  • Intel vs Apple Silicon
  • Installing things with and without Rosetta at the same time on an Apple Silicon Mac
  • The Ruby version you’re trying to install
  • The current active Ruby version
  • The version manager used (asdf, chruby, frum, rbenv, ruby-install, rvm)
  • Which OpenSSL versions are installed and which one you’re trying to compile with
  • Missing, misconfigured, and outdated dev tools
  • PATH issues
  • Setting ENV vars and other compilation settings globally in your shell startup file (.zshrc, .zprofile, .zlogin, .bash_profile, .bashrc, .profile, etc.)
  • The combination of things you installed so far, and the order in which you installed them

The fact that a successful Ruby installation depends on so many things is the reason why a solution that works for one person might not work for someone else. Also, keep in mind that most people who say a particular command worked for them are just blindly trying different things without understanding why something worked or didn’t work.

For example, if someone tells you to run the following command:

rvm install ruby-3.3.1 -C --with-openssl-dir=/usr/local/etc/openssl@3

It won’t work if you’re on an Apple Silicon Mac, unless you’re using Rosetta, which I don’t recommend, especially for Ruby versions higher than 2.6.10. That’s because Homebrew installs tools in /opt/homebrew on an Apple Silicon Mac, and in /usr/local on an Intel Mac (or when using Rosetta on an Apple Silicon Mac).

Similarly, beware of people who tell you to set flags such as the ones below, especially if they tell you to set them globally in your shell startup file (such as ~/.zshrc):

CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
optflags="-Wno-error=implicit-function-declaration"

If you have a proper Ruby development setup, settings like the ones above are completely unnecessary. Some are dangerous hacks that override macOS defaults. I’ve been working with Ruby for 13 years and not once have I ever had to set the flags above.

Settings that affect Ruby compilation should never be set globally because those settings are used by other tools, and it can affect their installation. Also, some settings only work with certain Ruby versions. So, you might be able to install Ruby versions 3.1+, but not versions less than 3.1, and you’ll waste even more time trying to figure out what’s going on.

So what’s the proper way to install and maintain Ruby on a Mac?

Here are the two options I recommend:

  • Have everything set up for you in 15 minutes or less with a single command
  • Spend an hour or more fixing things and setting everything up manually

Have everything set up for you in 15 minutes or less with a single command

Over the past twelve years, I’ve helped hundreds of thousands of people set up Ruby on their Mac. This experience led me to build Ruby on Mac, an automated solution that is guaranteed to get you unstuck right away, and will save you hundreds of hours for years to come. The creator of RVM, Wayne Seguin, is a happy customer and he considers it a “serious time saver.” Read 150+ testimonials from people who love Ruby on Mac.

What’s special and unique about Ruby on Mac is that it can automatically fix your outdated or misconfigured development setup in minutes, saving you from having to wipe your computer. It also automatically installs all the other development tools you’ll need for Rails, Jekyll, Flutter, React Native, or any other project that depends on Ruby. It will save you so much time and frustration.

Unlike other tools, Ruby on Mac Ultimate automatically uses the correct settings based on the Ruby version, your Mac model, macOS version, Xcode/command line tools version, and other factors. You will never need to waste time figuring out which settings to use (such as --with-openssl-dir), or figuring out the correct OpenSSL version to use.

All you have to do is specify the Ruby version, and Ruby on Mac will take care of everything else for you. For example:

rom install ruby 3.1.5

You will have the peace of mind that your Ruby development setup will always be properly configured.

Spend an hour or more fixing and setting everything up manually

If you prefer to spend an hour or more doing everything manually, you can follow my free step-by-step guide for installing Ruby on a Mac. The guide works best when you start with a clean development environment, so you might need to spend an additional hour or more uninstalling all dev tools, or backing up your computer, reformatting the hard drive, and reinstalling macOS.