These days, go to Apple's app store and get Xcode.
Open Xcode
In XCode's Preferences > Downloads you can install command line tools.
Short instructions with a picture
sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer
Go into the OSX Installer library and read the ReadMe.