THIS GUIDE IS OLD! Go to http://echo.co/blog/os-x-1010-yosemite-local-development-environment-apache-php-and-mysql-homebrew for the Yosemite version.
Go to http://developer.apple.com/downloads, log in with your Apple ID (free) and download the newest version of either Command Line Tools (OS X Lion) for Xcode or Command Line Tools (OS X Mountain Lion) for Xcode. Run the installer in the dmg and you'll have the LLVM compiler, make
, and other build tools.