When using "
gem install [something]" after installing Mountain Lion, you may encounter this error:
Building native extensions. This could take a while...
ERROR: Error installing rails:
ERROR: Failed to build gem native extension.
make: /usr/bin/gcc-4.2: No such file or directory
make: *** [generator.o] Error 1
Apple removed GCC 4.2. We'll just put it back where make expects it to be. First install the package manager Homebrew. Then in Terminal do:
$ brew tap homebrew/dupes
$ brew install apple-gcc42
$ sudo ln -s /usr/local/bin/gcc-4.2 /usr/bin/gcc-4.2
UPDATED: added the
brew tap line. As rathrio notes, for some users the extra step is necessary.