読者です 読者をやめる 読者になる 読者になる

気の向くままにプログラミング

南国ビーチでのリモートワーク生活を目指す凡人

CentOS 6.8でRubyインストール時のエラー対処方法

Rubyインストール

$rbenv install 2.2.3

BUILD FAILED (CentOS release 6.8 (Final) using ruby-build 20170201-7-g5d62e84)

Inspect or clean up the working tree at /home/crawl/tmp/ruby-build.20170302094138.1592
Results logged to /home/crawl/tmp/ruby-build.20170302094138.1592.log

Last 10 log lines:
~/tmp/ruby-build.20170302094138.1592/ruby-2.2.3 ~/tmp/ruby-build.20170302094138.1592 ~
checking build system type... x86_64-pc-linux-gnu
checking host system type... x86_64-pc-linux-gnu
checking target system type... x86_64-pc-linux-gnu
checking for gcc... no
checking for cc... no
checking for cl.exe... no
configure: error: in `/home/crawl/tmp/ruby-build.20170302094138.1592/ruby-2.2.3':
configure: error: no acceptable C compiler found in $PATH
See `config.log' for more details

Cコンパイラが見つからないと言っているので、Cコンパイラをインストール

$yum install -y gcc

再実行

$rbenv install 2.2.3

BUILD FAILED (CentOS release 6.8 (Final) using ruby-build 20170201-7-g5d62e84)

Inspect or clean up the working tree at /home/crawl/tmp/ruby-build.20170302094952.2754
Results logged to /home/crawl/tmp/ruby-build.20170302094952.2754.log

Last 10 log lines:
installing rdoc:              /home/crawl/.rbenv/versions/2.2.3/share/ri/2.2.0/system
installing capi-docs:         /home/crawl/.rbenv/versions/2.2.3/share/doc/ruby
The Ruby readline extension was not compiled.
ERROR: Ruby install aborted due to missing extensions
Try running `yum install -y readline-devel` to fetch missing dependencies.

今度も言われた通りにやってみる。

$yum install -y readline-devel

再実行

$rbenv install 2.2.3

$rbenv versions
  2.2.3

成功!