In both cases, you need to ​register as an Apple developer first (free).

Previous versions of OS X and Xcode

Get the most recent version of Apple's Xcode tools that you can. Your OS X CD has a version on it. You may be able to download a newer version from the ​Apple Developer Connection website. You may need to sign up for a free membership in the Apple Developer Connection, and downloading may still cost a little money. In later versions of OS X (10.6 / 10.7), Apple added the "App Store". Xcode is available within the App Store for "Free".

Successful builds of older GHC sources have been reported using Xcode 3.0, 2.4 and 2.4.1 on Intel Macs. Xcode 2.2.1 is known not to work out of the box on Intel Macs, and Xcode 3.0 is known not to work out of the box on PowerPC Macs (#2887). Versions prior to 3.1 may build GHC successfully, but choke on certain libraries.

GHC

Secondly, you need a installation of GHC for use as your bootstrap compiler.