Translate

August 15, 2012

Missing gcc-4.2 on Mountain Lion

Missing gcc-4.2 on Mountain Lion

I've seen reports of missing /usr/bin/gcc-4.2 on OSX 10.8 (Mountain Lion). Some have tried to reinstall xCode and that worked for them.

I got this when I was trying to install gem
    make
    ....
    make: /usr/bin/gcc-4.2: No such file or directory
    make: *** [bcrypt_ext.o] Error 1
    

Executing following command solved problem on my system.

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

apple-gcc42 installs its gcc-4.2 binary into /usr/local/bin (or wherever you installed Homebrew), not /usr/bin.
Your ruby gems are probably trying to use gcc-4.2 because ruby configures itself to build C extensions with whichever compiler built ruby itself. If you built ruby using gcc-4.2 on an older version of Xcode when that still came with gcc-4.2, that would explain why it's looking for that specific path. Reinstalling ruby with /usr/local/bin/gcc-4.2 would fix the problem.

Note: Linking /usr/bin/gcc to /usr/bin/gcc-4.2 is not perfect way, This is simple trick.
Post a Comment