this is the correct way !!
Open Xcode, then choose "Preferences..." from the Xcode menu (or press ⌘+,). Go to the Locations panel and install the tools by selecting the most recent version in the Command Line Tools dropdown.
Topic:
App Store Distribution & Marketing
SubTopic:
General
Tags: