rbenv install時に「ruby-build: TMPDIR=/xxx is set to a non-accessible location」が発生

rbenv install時に「ruby-build: TMPDIR=/xxx is set to a non-accessible location」が発生

rbenv install実行時に「ruby-build: TMPDIR=/tmp is set to a non-accessible location」が発生した場合の対処法を記述してます。

環境

  • OS CentOS Linux release 7.9.2009 (Core)
  • rbenv 1.1.2-40-g62d7798

エラー全文

以下のコマンドを実行時に発生。

rbenv install -v 2.7.2

<出力結果>
ruby-build: TMPDIR=/tmp is set to a non-accessible location

対処法

原因が詳しくわからなかったですが、別のディレクトリをTMPDIRとして指定して実行してあげれば問題は解決します。

TMPDIR="${PWD}/tmp" rbenv install -v 2.7.2

それか「TMPDIR」を設定してあげる。

export TMPDIR="${PWD}/tmp"