xcode-select --install
For older versions of OS X (10.5-10.7) use the most recent available installer available here. Use the Leopard installer for 10.5 and the Snow Leopard installer for 10.6-10.7.
gcc --help
. If you receive an error, use
the package manager to install the GNU GCC compiler