bundle install 時に An error occured while installing json (1.7.7)


mac で bundle install を実行した際に下記エラーが発生

エラー文

Installing json (1.7.7)
Gem::Installer::ExtensionBuildError: ERROR: Failed to build gem native extension.

        /usr/local/Cellar/ruby/1.9.3-p194/bin/ruby extconf.rb
creating Makefile

make
compiling generator.c
xcrun: error: unable to find utility "gcc-4.2", not a developer tool or in PATH
make: *** [generator.o] Error 69


Gem files will remain installed in /private/etc/chef/vendor/bundle/ruby/1.9.1/gems/json-1.7.7 for inspection.
Results logged to /private/etc/chef/vendor/bundle/ruby/1.9.1/gems/json-1.7.7/ext/json/ext/generator/gem_make.out

An error occurred while installing json (1.7.7), and Bundler cannot continue.
Make sure that `gem install json -v '1.7.7'` succeeds before bundling.

解決方法

gccのシンボリックリンクを設定して再実行すればうまく動いた

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

参考URL

Rails: can’t run app because “An error occured while installing json (1.7.7)”