3
2

More than 3 years have passed since last update.

rbenvでRuby2.6.5がインストールできない

Last updated at Posted at 2020-04-15

環境

vagrant
CentOS7
Rails 5.2.4.2
Ruby 2.5.7

概要


別のディレクトリにあったアプリを仮想環境に持ってきて、localでそのアプリのRubyのバージョンに合わせようとした結果、、、、
Downloading ruby-2.6.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2
Installing ruby-2.6.5...

BUILD FAILED (CentOS Linux 7 using ruby-build 20200401-7-g637ddf3)

Inspect or clean up the working tree at /tmp/ruby-build.20200415132139.18095.v4x36d
Results logged to /tmp/ruby-build.20200415132139.18095.log

Last 10 log lines:
installing capi-docs:               /home/vagrant/.rbenv/versions/2.6.5/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.

Configure options used:
  --prefix=/home/vagrant/.rbenv/versions/2.6.5
  --enable-shared
  LDFLAGS=-L/home/vagrant/.rbenv/versions/2.6.5/lib
  CPPFLAGS=-I/home/vagrant/.rbenv/versions/2.6.5/include

またrbenvにやられた。

優しくしてください。まじで。

やったこと

その1 : エラー文にあるコマンドを実行

yum install -y readline-devel

エラー文にこう書いてあったので「あれ?入れてなかったっけ?」と思いながら実行。

$sudo yum install -y readline-devel
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
 * base: ftp.tsukuba.wide.ad.jp
 * extras: ftp.tsukuba.wide.ad.jp
 * updates: ftp.tsukuba.wide.ad.jp
base                                                                            | 3.6 kB  00:00:00
extras                                                                          | 2.9 kB  00:00:00
nodesource                                                                      | 2.5 kB  00:00:00
updates                                                                         | 2.9 kB  00:00:00
Package readline-devel-6.2-11.el7.x86_64 already installed and latest version
Nothing to do

いやあるんかーーーーい。。。

その2 : いろいろ模索


rbenvのバージョンの問題かな?と思い、以下を実行
rbenv update

ちなみにrbenvはプラグインなので、

git clone https://github.com/rkh/rbenv-update.git "$(rbenv root)/plugins/rbenv-update"

これをお忘れなく。
さて、
いざインストール!!!

BUILD FAILED (CentOS Linux 7 using ruby-build 20200401-7-g637ddf3)

俺の負け!!!!!

その3 : ぐぐる


以下の記事を発見。

環境変数で「Ruby install aborted due to missing extensions」の対象の奴らを教えてあげるのね。
よし実行!
BUILD FAILED (CentOS Linux 7 using ruby-build 20200401-7-g637ddf3)

はい負け!!!!!

その4 : もしやと思い、brewでreadlineをインストール

-> % brew reinstall readline
==> Reinstalling readline
==> Downloading https://linuxbrew.bintray.com/bottles/readline-8.0.4.x86_64_linux.bottle.tar.gz
==> Downloading from https://akamai.bintray.com/46/46da47db3da04b2f248e3cf2d6d14c55aa543555d1134f6cbbf07787a5bf0bd6?__gda__=exp=1586966897~hmac=
######################################################################## 100.0%
==> Pouring readline-8.0.4.x86_64_linux.bottle.tar.gz
🍺  /home/linuxbrew/.linuxbrew/Cellar/readline/8.0.4: 53 files, 1.9MB

からの

-> % rbenv install 2.6.5
Downloading ruby-2.6.5.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.5.tar.bz2
Installing ruby-2.6.5...
ruby-build: using readline from homebrew
Installed ruby-2.6.5 to /home/vagrant/.rbenv/versions/2.6.5

行けた!!!!!!!!!
brewにreadlineないから読めねぇ!!ってことなのか?
yumでインストールしろって言ったくせに、、、。
よくわからない、、、。

3
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
3
2