LoginSignup
11
8

More than 5 years have passed since last update.

rbenvでrubyをインストールできない

Last updated at Posted at 2016-01-05

環境

OSX ElCapitan(10.11.2)

はまったとこ

rbenvでruby2.2.2をインストール...できない

$ rbenv install 2.2.2
 Downloading ruby-2.2.2.tar.bz2...
 -> https://cache.ruby-lang.org/pub/ruby/2.2/ruby-2.2.2.tar.bz2
 Installing ruby-2.2.2...

 BUILD FAILED (OS X 10.11.2 using ruby-build 20151230)

 Inspect or clean up the working tree at /var/folders/v6/hwyn6rq15p73fn962_y21hkc0000gn/T/ruby-build.20160106042805.26781
Results logged to /var/folders/v6/hwyn6rq15p73fn962_y21hkc0000gn/T/ruby-build.20160106042805.26781.log
Last 10 log lines:
/var/folders/v6/hwyn6rq15p73fn962_y21hkc0000gn/T/ruby-build.20160106042805.26781 ~/rails_projects/TwitterRanking
/var/folders/v6/hwyn6rq15p73fn962_y21hkc0000gn/T/ruby-build.20160106042805.26781/ruby-2.2.2 /var/folders/v6/hwyn6rq15p73fn962_y21hkc0000gn/T/ruby-build.20160106042805.26781 ~/rails_projects/TwitterRanking
config.guess already exists
config.sub already exists
checking build system type... x86_64-apple-darwin15.2.0
checking host system type... x86_64-apple-darwin15.2.0
checking target system type... x86_64-apple-darwin15.2.0
./configure: line 3696: /usr/bin/gcc-4.2: No such file or directory
configure: error: clang version 3.0 or later is required
make: *** No targets specified and no makefile found.  Stop.

最後のあたりを見ると、/usr/bin/gcc-4.2がないのと、
clangが3.0以上じゃないとダメ?みたいな?よくわからなくてつらい...
とりあえず

$ clang -v
Apple LLVM version 7.0.2 (clang-700.1.81)
Target: x86_64-apple-darwin15.2.0
Thread model: posix

あるし、、
んじゃあもう一つの方の./configure: line 3696: /usr/bin/gcc-4.2: No such file or directoryってのは、、、

$ ls /usr/bin

でわかるけど、確かにgcc-4.2はない。ではどうすれば?てことでググると、
http://stackoverflow.com/questions/12256616/os-x-mountain-lion-gcc-4-2-no-such-file-or-directory
こんなstackoverflowを発見。
sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
こんな感じでシンボリックリンクを貼れば直るらしい、

$ sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2
Password:
ln: /usr/bin/gcc-4.2: Operation not permitted

rootless.....

う〜〜ん詰み、、、ってとこで、coa00@githubさんの
http://qiita.com/coa00@github/items/b50d06980187b0685349
こんな記事を発見、、これの通りに、~/.zshenv
export CC=/usr/bin/gcc
ってのを追加、、、、

通った、、、、

おわり

11
8
0

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
11
8