All commands assume you are at the prompt. The prompt seperator “$” has been ommited.
Download Xcode from App Store. then open Xcode and select the following. As of Xcode 8.2 the Developer Tools are installed automatically.
Preferences > Downloads > Command Line Tools