rbenv installコマンドを利用してRubyのインストールをしていたら、以下のエラーが発生しました。
xcrun: error: active developer path ("/Applications/Xcode.app/Contents/Developer") does not exist
Use `sudo xcode-select --switch path/to/Xcode.app` to specify the Xcode that you wish to use for command line developer tools, or use `xcode-select --install` to install the standalone command line developer tools.
See `man xcode-select` for more details.
xcode-selectコマンドが参照するパスが存在しないというエラーです。どうやらXcode Appをアンインストールしたことによって、もともと参照していたパスが無くなったことで発生していました。
しかし、コマンドラインツールはインストール済みでしたので、再度Xcode Appを再インストールせずにコマンドラインツールのパスを切り替えることにしました。
$ xcode-select --install
xcode-select: error: command line tools are already installed, use "Software Update" to install updates
以下のコマンドでコマンドラインツールの参照先を変更し、エラーが解消されました。
$ xcode-select -print-path
/Applications/Xcode.app/Contents/Developer
$ sudo xcode-select --switch /Library/Developer/CommandLineTools/
$ xcode-select -print-path
/Library/Developer/CommandLineTools
以上です。