それマグで!

知識はカップより、マグでゆっくり頂きます。 takuya_1stのブログ

習慣に早くから配慮した者は、 おそらく人生の実りも大きい。

macでrubyのgemを使うとgccがなんか変なので治す。

rmagickやsqliteをgemで入れようとしたらエラーになった。

gem install rmagickがエラー

エラーの詳細

takuya@air:~$ gem install rmagick
Building native extensions.  This could take a while...
ERROR:  Error installing rmagick:
     ERROR: Failed to build gem native extension.


        /Users/takuya/.rvm/rubies/ruby-1.8.7-p357/bin/ruby extconf.rb
checking for Ruby version >= 1.8.5... yes
checking for /usr/bin/gcc-4.2... no
No C compiler found in ${ENV['PATH']}. See mkmf.log for details.
*** extconf.rb failed ***
Could not create Makefile due to some reason, probably lack of
necessary libraries and/or headers.  Check the mkmf.log file for more
details.  You may need configuration options.


Provided configuration options:
     --with-opt-dir
     --without-opt-dir
     --with-opt-include
     --without-opt-include=${opt-dir}/include
     --with-opt-lib
     --without-opt-lib=${opt-dir}/lib
     --with-make-prog
     --without-make-prog
     --srcdir=.
     --curdir
     --ruby=/Users/takuya/.rvm/rubies/ruby-1.8.7-p357/bin/ruby

Gem files will remain installed in /Users/takuya/.rvm/gems/ruby-1.8.7-p357/gems/rmagick-2.13.1 for inspection.


gccで指定された gcc-4.2ねーよバカ。って言われたのですが、llvmのMacだとそんなファイルあるわけねーよバカって言い返したい。
言い返したところで、コンパイルできないのです。どうするか

リンク作ってみた

sudo ln -s /usr/bin/gcc /usr/bin/gcc-4.2

とln してごまかした。

ln だけでインストールできた

gem install rmagick 

できた

lnで十分なんだけど。

4.3になったり4.2.1なったりしたら動かなさそう。バージョン変わったらまた ln し直しかなぁ。