GCC is included with XCode but if you really just need GCC, I also found this project on GitHub for the OSX GCC installer.
The osx-gcc-installer allows you to install the essential compilers from either pre-built binary packages or helps you create your own installer.
For Lion and Mountain Lion users, Apple now provides an official Command Line Tools for Xcode package that you can install without needing to install Xcode itself! You can download it from Apple's developer site. If you still need gcc-4.2, and you use Homebrew, you can install it using the apple-gcc42 package from homebrew/dupes.
Okay, go get the older 4.0 package that was included with XCode 3.1 from Apples Open Source page
Download the gcc-5493 package and I tested compiling using instructions from the README.Apple
BUILDING, THE APPLE WAY didn't work for me but the BUILDING, THE FSF WAY worked with modification...
To build things the FSF WAY way i need to add the
--enable-languages=objc,c++,obj-c++ to restrict languages. Something was causing it to error out and I don't have time to figure out which one. But using below successfully compiled.
../configure --prefix=/tmp/testplace --enable-languages=objc,c++,obj-c++
Also make sure you have XCode and Command line tools installed
Using built-in specs.
Configured with: ../configure --prefix=/tmp/testplace --enable-languages=objc,c++,obj-c++
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5493)