G33K-TRICKS: [Solved] How to resolve Ruby "Error running 'rvm_make -j10'" error on Macbook

Thursday, May 19, 2022

[Solved] How to resolve Ruby "Error running 'rvm_make -j10'" error on Macbook


[Solved] How to Fix "__rvm_make -j10" error while installing Ruby on Mac machines

Install ruby on macbook m1 pro

We often have to switch from one machine to other or sometimes we go for an upgrade. In my case, I moved from Mac Pro 2016 Intel based chip to Macbook Pro 16 inch,  Apple M1 Pro based chipset and got stuck with this error.

You must have a prior experience, Installing Ruby has always been hassle on Mac/Ubuntu machines but moving away from Intel Chip to M1 Pro added few more challenges. 

RVM is Ruby Version Manager which is command line tool which helps in install, manage and work with different Ruby environments. RVM can also help in switching between different version of Ruby on your computer.

While installing Ruby via RVM, I was constantly getting below error.


> rvm install 2.6.5 

Error running '__rvm_make -j10',

please read /Users/<username>/.rvm/log/1652946926_ruby-2.6.5/make.log

There has been an error while running make. Halting the installation.


Because of the above error, I was not able to Install the Ruby and the installation was halted. My initial assumption was, it is due to OpenSSL lib on machine but it was not. Looking at the make log file, I found that there were many errors and was not able to figure out how to resolve this error. 

Finally after few trial and error, I could resolve the error with this guide.

Here are easy steps to Install Ruby on Macbook Pro with Apple M1 Pro chipset


PreRequisites:

- Brew should already be installed on your machine.
- And change the architecture of your terminal to "arch -arm64 zsh" OR "arch -arm64 sh"

1. Download  the ruby file given in below link
https://raw.githubusercontent.com/rbenv/homebrew-tap/e472b7861b49cc082d1db0f66f265368da107589/Formula/openssl%401.0.rb

2. Save the file to your machine

3. Run brew install <pathWhereFileIsDownloaded>/openssl@1.0.rb

4. Add below path to your shell's rc file
echo 'export PATH="/opt/homebrew/opt/openssl@1.0/bin:$PATH"' >> ~/.zshrc

echo 'export LDFLAGS="-L/opt/homebrew/opt/openssl@1.0/lib"' >> ~/.zshrc
echo 'export CPPFLAGS="-I/opt/homebrew/opt/openssl@1.0/include"' >> ~/.zshrc
echo 'export PKG_CONFIG_PATH="/opt/homebrew/opt/openssl@1.0/lib/pkgconfig"' >> ~/.zshrc

5.  Close the terminal and reopen new OR run source ~/.zshrc to reload the config

6.  Confirm the OpenSSL lib being used by running command:
     openssl version
     
    which returns:

    OpenSSL 1.0.2u  20 Dec 2019

7. Run below command to Disable RVM autolibs 
  rvm autolibs disable 

8. Run below export commands: 
    export RUBY_CFLAGS=-DUSE_FFI_CLOSURE_ALLOC
  export optflags="-Wno-error=implicit-function-declaration"

9. rvm install 2.6.5 --with-openssl-dir=/opt/homebrew/opt/openssl@1.0
 (you can choose any ruby version here)

The final Step #9 should install Ruby and you should see below line confirming Ruby is installed

Install of ruby-2.6.5 - #complete

You can also run :  rvm list  to confirm the ruby version installed status.


If above given steps does not resolve your issue, you can also try running below command which might resolve:

a) apt purge libssl-dev && apt install libssl1.0-dev

b)  rvm install 2.6.6 --with-out-ext=fiddle


Incase, you are seeing the issue on macOS Big Sur, be sure to run this before install a Ruby via RVM:


export warnflags=-Wno-error=implicit-function-declaration


For Reference you can visit this Github issue for RVM and scroll to the bottom of the page to confirm this answer.


Please add your comments, if it helped to resolve the ruby installation.



Incoming Searches:
Error running 'rvm_make -j16'
Error running 'rvm_make -j12'
Error running 'rvm_make -j10'
Error running 'rvm_make -j8'
Error running 'rvm_make -j4'
Error running 'rvm_make -j2'
error running '__rvm_make -j8',
Error running 'rvm_make -j16',
Error running 'rvm_make -j12',
Error running 'rvm_make -j10',
Error running 'rvm_make -j8',
Error running 'rvm_make -j4',
Error running 'rvm_make -j2',

No comments: