LoginSignup
4

More than 3 years have passed since last update.

posted at

updated at

rbenvでrubyをインストールできなかったのでメモ

はまったところ

Mojaveのアップデートした後にrbenvでrubyをインストールしようとしたら、うまくいかなかった

環境

  • macOS Mojave 10.14.4
  • Xcode 10.2.1
  • xcode-select version 2354
  • rbenv 1.1.2

エラー

$ rbenv install -v 2.6.3
ruby-build: use openssl from homebrew
/var/folders/gd/832wl82904162ggc23xtzjb80000gn/T/ruby-build.20190508142609.22790 ~
Downloading ruby-2.6.3.tar.bz2...
-> https://cache.ruby-lang.org/pub/ruby/2.6/ruby-2.6.3.tar.bz2
/var/folders/gd/832wl82904162ggc23xtzjb80000gn/T/ruby-build.20190508142609.22790/ruby-2.6.3 /var/folders/gd/832wl82904162ggc23xtzjb80000gn/T/ruby-build.20190508142609.22790 ~
Installing ruby-2.6.3...
ruby-build: use readline from homebrew
checking for ruby... /usr/bin/ruby
tool/config.guess already exists
tool/config.sub already exists
checking build system type... x86_64-apple-darwin18.5.0
checking host system type... x86_64-apple-darwin18.5.0
checking target system type... x86_64-apple-darwin18.5.0
./configure: line 3491: gcc-4.2: command not found
configure: error: clang version 3.0 or later is required
make: *** No targets specified and no makefile found.  Stop.

BUILD FAILED (OS X 10.14.4 using ruby-build 20190423)

対処法

XcodeとCommand Line Toolsはインストール済みでしたが、
念の為再インストール

$ sudo rm -rf /Library/Developer/CommandLineTools
$ xcode-select --install

これでも同じエラーだったので、~./bash_profileに以下を追加

echo 'export CC=/usr/bin/gcc' >> ~/.bash_profile
source ~/.bash_profile

参考

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
What you can do with signing up
4