How to Fix the “Error Running ‘__rvm_make -j12’” When Installing Ruby with RVM on macOS

If you tried to install a Ruby version with RVM (Ruby Version Manager) on macOS, you may have seen this error: “Error running ‘__rvm_make -j12′”. Many macOS users face this problem. The error usually happens because of a version mismatch with OpenSSL.

Error running ‘__rvm_make -j12’,
please read /Users/username/.rvm/log/_ruby-3.2.2/make.log
There has been an error while running make. Halting the installation.

In this article, we explain why the error occurs. We also show you how to diagnose it and fix it.

Error running ‘__rvm_make

When you run RVM to install Ruby, it downloads the source code and compiles it. During compilation, RVM runs a make command (e.g. __rvm_make -j12). The -j12 flag tells make to use 12 cores.

RVM Make Error in macOS
RVM Make Error in macOS

If the process fails, RVM stops the installation. It then tells you to check the log file (found in ~/.rvm/log/).

The RVM Make Error in macOS is a common issue that prevents Ruby from compiling. The error message is generic and does not explain the cause. In many cases, the problem is a library dependency. For Ruby, the likely culprit is OpenSSL.

Identifying the Root Cause: OpenSSL Version Mismatch

On macOS, package managers like Homebrew may install OpenSSL 3 by default. Many Ruby versions expect OpenSSL 1.1. When Ruby’s build scripts use an incompatible OpenSSL version, the build fails.

This issue is well documented. GitHub issues, Stack Overflow posts, and technical blogs report similar problems.

For example, when installing Ruby 3.2.x, you may see errors related to OpenSSL functions. The log file often shows that the build is using features from OpenSSL 3. Ruby’s source may not support these features.

How to Fix RVM Make Error in macOS by Using OpenSSL 1.1

The best solution is to force Ruby’s build process to use OpenSSL 1.1 instead of OpenSSL 3. You can do this by installing OpenSSL 1.1 with Homebrew. Then, tell RVM to use that version during compilation.

Step 1: Install OpenSSL 1.1 via Homebrew

Open your terminal and run:

brew install [email protected]

This command installs the legacy OpenSSL version that Ruby requires.

Step 2: Install Ruby with RVM Using the Correct OpenSSL Directory

Next, tell RVM to use the OpenSSL 1.1 libraries. Pass the correct flag to the rvm install command. For example, to install Ruby 3.2.2, run:

rvm install ruby-3.2.2 --with-openssl-dir=$(brew --prefix [email protected])

Alternatively, you can set the PKG_CONFIG_PATH environment variable. This ensures that the build process finds the right package configuration files:

PKG_CONFIG_PATH=$(brew --prefix [email protected])/lib/pkgconfig \
rvm install ruby-3.2.2 --with-openssl-dir=$(brew --prefix [email protected])

These commands direct Ruby’s configuration scripts to the Homebrew-installed OpenSSL 1.1. They prevent the build system from using the default OpenSSL (version 3).

Additional Tips for Apple Silicon Users

If you run macOS on an M1, M2, or M3 chip, consider these points:

  • Architecture Compatibility: Use the native ARM version of Homebrew and RVM. The commands above usually work for both Intel and Apple Silicon. If you run into issues, try prefixing the command with arch -arm64.
  • Rosetta Considerations: If you are not using Rosetta, check that your environment variables and paths are set for the ARM architecture.

Updating Xcode Command Line Tools

An outdated version of Xcode’s command line tools can also cause build errors. If you still see errors after adjusting your OpenSSL settings, update or reinstall the Command Line Tools:

sudo rm -rf /Library/Developer/CommandLineTools
xcode-select --install

After the tools are installed, try reinstalling Ruby with RVM.

Conclusion

The error running __rvm_make -j12 is usually caused by a mismatch with OpenSSL versions. Ruby expects OpenSSL 1.1, but your system might use OpenSSL 3.

To fix this problem:

  • Install OpenSSL 1.1:
brew install [email protected]
  • Install Ruby using RVM with the correct OpenSSL path:
rvm install ruby-3.2.2 --with-openssl-dir=$(brew --prefix [email protected])
  • (Optional) Set PKG_CONFIG_PATH to be extra sure:
PKG_CONFIG_PATH=$(brew --prefix [email protected])/lib/pkgconfig \
rvm install ruby-3.2.2 --with-openssl-dir=$(brew --prefix [email protected])
  • Update Xcode Command Line Tools if needed.

Following these steps should allow you to compile and install Ruby successfully. Happy coding!

Leave a Comment

Comments

No comments yet. Why don’t you start the discussion?

    Comments