22
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

<1つの解決策:Mac>CompilerSelectionError: OO cannot be built with any available compilers.

Last updated at Posted at 2018-12-03

rbenvをbrewでインストールすると、エラーが出ました(以下)。

MacBook-Pro-2:~ user$ brew install rbenv
Updating Homebrew...
==> 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

gccが必要なのかと、 gccをbrewでインストールすると、同じようなエラーが。。

MacBook-Pro-2:~ user$ brew install gcc
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: gcc cannot be built with any available compilers.
Install GNU's GCC
  brew install gcc


ここで、brewで何かインストールする事自体に不具合が生じていると思い、とりあえず、エラーの他の部分をいくつかググってみました。

すると、
”xcrun: error: invalid active developer path (/Library/Developer/CommandLineTools), missing xcrun at: /Library/Developer/CommandLineTools/usr/bin/xcrun”
の部分をググってヒットしたリンク
https://qiita.com/ARTS_papa/items/60ba305b23dc967bba87
で、解決。
(以下のコードをターミナルで実行するだけです。)

$ xcode-select --install

xcodeの何かがインストールされて解決。
(本来Xcodeのなかにgccコンパイラーが入っていて、xcodeの一部か全部が欠落してたっぽい。)
(ブラウザに飛んでインストールされました。)

。問題なくbrewでのrbenvのダウンロードができたとさ。

MacBook-Pro-2:~ user$ brew install rbenv
Updating Homebrew...
==> Auto-updated Homebrew!
Updated 1 tap (homebrew/core).
==> Updated Formulae
composer                   fx                         libswiften

==> Installing dependencies for rbenv: ruby-build
==> Installing rbenv dependency: ruby-build
==> Downloading https://github.com/rbenv/ruby-build/archive/v20181106.tar.gz
==> Downloading from https://codeload.github.com/rbenv/ruby-build/tar.gz/v201811
######################################################################## 100.0%
==> ./install.sh
🍺  /usr/local/Cellar/ruby-build/20181106: 420 files, 212.6KB, built in 11 seconds
==> Installing rbenv
==> Downloading https://homebrew.bintray.com/bottles/rbenv-1.1.1.mojave.bottle.1
######################################################################## 100.0%
==> Pouring rbenv-1.1.1.mojave.bottle.1.tar.gz
🍺  /usr/local/Cellar/rbenv/1.1.1: 36 files, 62.8KB

MacBook-Pro-2:~ user$ rbenv version
system (set by /Users/user/.rbenv/version)
MacBook-Pro-2:~ user$ rbenv -v
rbenv 1.1.1
22
15
1

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
22
15

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?