How to Fix ‘error running __rvm_make’ When Installing Ruby with RVM

Fix Rvm Make Error: Encountering the error running '__rvm_make while installing Ruby with RVM can be frustrating, especially when trying to set up a development environment. This error is usually related to issues with OpenSSL compatibility, missing dependencies, or system configuration problems. In this guide, we will provide a detailed step-by-step approach to diagnosing and fixing the issue.

Rvm Make Error

The __rvm_make error typically occurs when RVM (Ruby Version Manager) fails to compile Ruby from source. The root cause can vary, but the most common reasons include:

  • Incompatible OpenSSL version – Older Ruby versions require OpenSSL 1.1 instead of OpenSSL 3.
  • Missing dependencies – Essential development tools and libraries are not installed.
  • Incorrect OpenSSL path – RVM is unable to find the correct OpenSSL installation.
  • Permission issues – Running RVM without the necessary user privileges.

Step 1: Verify Your OpenSSL Version

To check which OpenSSL version is installed on your system, run the following command:

openssl version

If it returns OpenSSL 3.x, but you are trying to install a Ruby version older than 3.0, you will likely face compatibility issues. In such cases, you need to install OpenSSL 1.1.

Step 2: Install OpenSSL 1.1

For macOS users using Homebrew, install OpenSSL 1.1 with:

brew install [email protected]

For Ubuntu/Debian-based Linux distributions, use:

sudo apt update && sudo apt install -y libssl-dev

For Fedora-based distributions:

sudo dnf install -y compat-openssl11

Step 3: Install Ruby with the Correct OpenSSL Path

If OpenSSL 1.1 is installed, RVM must be explicitly told to use it when compiling Ruby. Use the following command:

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

Replace 2.7.1 with the version of Ruby you are trying to install. If you are on Linux, find the correct OpenSSL installation path using:

openssl version -d

Then, use:

rvm install 2.7.1 --with-openssl-dir=/usr/local/opt/[email protected]

Step 4: Ensure Required Dependencies Are Installed

On macOS:

brew install gcc readline libyaml gmp

On Ubuntu/Debian:

sudo apt install -y build-essential libreadline-dev zlib1g-dev libssl-dev libyaml-dev libgmp-dev

On Fedora-based distributions:

sudo dnf install -y @development-tools readline-devel zlib-devel libssl-devel libyaml-devel gmp-devel

Step 5: Grant Proper Permissions to RVM

If you installed RVM system-wide, you might face permission issues. Ensure your user has the correct permissions:

rvm get stable
rvm fix-permissions

Also, if you installed RVM without adding your user to the rvm group, do so with:

usermod -a -G rvm $(whoami)

Then, restart your terminal or run:

source ~/.rvm/scripts/rvm

Step 6: Verify the Ruby Installation

After installing Ruby, confirm that it is using the correct OpenSSL version:

ruby -ropenssl -e 'puts OpenSSL::OPENSSL_VERSION'

This should output something like:

OpenSSL 1.1.1l  FIPS  24 Aug 2021

If the OpenSSL version is incorrect, uninstall and reinstall Ruby with the proper OpenSSL path.

Conclusion

The error running '__rvm_make' issue is primarily caused by OpenSSL incompatibilities, missing dependencies, or incorrect permissions. By following this guide, you should be able to resolve the error and successfully install Ruby with RVM.

If you continue facing issues, consider checking the RVM logs using:

cat ~/.rvm/log/last_make.log

This log file can provide additional insights into what is causing the failure. If necessary, report the issue to the RVM community for further assistance.

Leave a Comment

Comments

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

    Leave a Reply