ruby rbenv install BUILD FAILED stuck problem solving

Introduction

This post would demo how to solve the “stuck problem” of the rbenv install process, eg. When you input this command to install ruby:

rbenv install 2.5.1

After waiting for a long time(some minutes) , you would get this:

Installing ...
Generating RI format into /tmp/ruby-build.20180414142048.32033/ruby-2.5.1/.ext/rdoc...
make: *** [rdoc] Killed

BUILD FAILED (CentOS 6.8 using ruby-build 20180329-3-g4dac7b1)

ok, let’s begin to solve this.

Environments

  • rbenv 1.1.1-30-gc8ba27f with plugin ‘ruby-build’ installed
  • OS CentOS 6.8

How to debug it

You can recognize that there is too little information to debug this problem, so we can turn on the verbose mode like this:

rbenv install --verbose 2.5.1

Then there would be much more information to help us to debug the problem , and we would still get this:

Generating RI format into /tmp/ruby-build.20180414142048.32033/ruby-2.3.7/.ext/rdoc...
make: *** [rdoc] Killed

Problem solving

the rdoc problem is occurred when you enable the ruby doc installation. So we can disable the doc install like this:

Execute the following command in your environment:

export RUBY_CONFIGURE_OPTS=--disable-install-doc

And then re-install the ruby

rbenv install --verbose 2.5.1

Everything would be ok like this:

Installed ruby-2.5.1 to /root/.rbenv/versions/2.5.1

You can find detail documents about the ruby here: