archive

rbenvがインストールできない |エラーになったときの対応


rbenvをインストールしようとしたら下記のようなエラーが出てしまいました。

`==> Installing dependencies for rbenv: ruby-build
==> Installing rbenv dependency: ruby-build
xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun
Error: An exception occurred within a child process:
  CompilerSelectionError: ruby-build cannot be built with any available compilers.
Install GNU's GCC:
  brew install gcc`

エラーを読んでいくと、下記のコマンドをうってくださいと指示があります。

`$brew install gcc`

打ち込んでみると、下記のような表記が。

`Error: The following formula
  gcc
cannot be installed as binary package and must be built from source.
Install the Command Line Tools:
  xcode-select --install`

これもよく読んでみると、下記のコマンドを入れてくださいと指示が丁寧にありました。

`$ xcode-select --install`

その後、でてくるダイアログにOKを押した後もう一度インストールします

`$ brew install rbenv ruby-build`

以下のコマンドでインストールできたかを確認します。

`$ rbenv -v`

rbenv ○.○.○というような表記が出てくれば、完了です。