Preamble – the Problem
If you prefer your testautomation like i do – in Ruby within a version manager – then it is likely that you will eventually face the following situation in one or the other way:
Error running '__rvm_make - j4' Please read [...]/make.log There has been an error while running make. Halting the installation.
A quick look into the mentioned make.log shows:
./miniruby: permission denied
In my case it happened, when i tried to conveniently install a Ruby from the 2.3 series using rvm:
rvm install 2.3.7
After a while full of painful investigation resulting in lots of „operation not permitted“, I decided to solve it in a pragmatic way: by using
The Solution: rvm mount
So what are we gonna do?
We will install Ruby from source to a custom directory first, and rvm mount it afterwards to make it available in RVM. We assume you have RVM installed already.
- First we need to make sure, that we have all required external dependencies. Usually openssl and gdbm are sufficient. Do brew install openssl and brew install gdbm
- Download and extract the source of your favorite Ruby-version to your Downloads-directory. For example from: https://cache.ruby-lang.org/pub/ruby/2.3/ruby-2.3.7.tar.gz (feel free to adapt the version to your target version)
- Open a terminal and move into the extracted folder.
- Do ./configure –with-gdbm-dir=“$(brew –prefix gdbm)“ –with-openssl-dir=“$(brew –prefix openssl)“ –prefix=RUBY_TARGET_DIR
- We have to specify gdbm’s and openssl’s installation directory, because brew installed these keg-only on my machine. That means it is installed, but not symlinked to /usr/bin or /usr/local/bin.
- RUBY_TARGET_DIR can be any custom directory you have free access to. I recommend smething like $HOME/rubies/<version key, e.g. 2.3.7/>
- Do make and make install.
- Now that we have our precious Ruby, where we want it to be, it is time to register it in RVM; do rvm mount /your/path/chosen/in/step4
- When prompted, give it a nice name and proceed. Don’t wonder, it will get prefixed with ext-. This is normal.
- Do rvm list and copy the name of your new Ruby.
- Do rvm use <the copied name> as usual.
- Check if your ruby is used correctly: Do ruby -v. It should display the expected ruby version.
- Go ahead and have fun with your new Ruby.
Starting from here, you achieved not only a Ruby that works, but also the freedom to build and install your favorite programming language exactly the way you want without missing out the cool features of a Ruby version manager and without any sudo-hassle. Maybe this way is a nice alternative for our fellow rbenv – users, too..? If you have a question, a better solution or any remarks, feel free to leave a comment. Otherwise, have a great day & rock on!!