鳳鳴は祖父の俳号

日記 メモ そんなの

gcc4.9のインストール

 MacOSXの開発環境XcodegccLLVMに置き換えられている。

$ gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 5.0 (clang-500.2.76) (based on LLVM 3.3svn)
Target: x86_64-apple-darwin12.5.0
Thread model: posix

 homebrewにてgcc4.9をインストールする方法:
rvm で ruby 1.8.7 インストール時にエラーになったので gcc 4.9 を homebrew で入れた | EasyRamble
homebrew で GCC 4.9 をインストールする - Sarabande.jp

実行するのは次:
$ brew tap homebrew/versions
$ brew install gcc49

gcc4.9に切り替えるには:

$ sudo rm /usr/local/bin/gcc
$ sudo rm /usr/local/bin/g++
$ sudo ln -s /usr/local/bin/gcc-4.9 /usr/local/bin/gcc
$ sudo ln -s /usr/local/bin/g++-4.9 /usr/local/bin/g++

$ gcc --version
gcc (GCC) 4.9.0 20130929 (experimental)
Copyright (C) 2013 Free Software Foundation, Inc.
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

LLVMに戻すには:

$ sudo rm /usr/local/bin/gcc
$ sudo rm /usr/local/bin/g++
$ sudo ln -s /usr/bin/gcc /usr/local/bin/gcc
$ sudo ln -s /usr/bin/g++ /usr/local/bin/g++