Download Xcode from Developer's website

Normally you can download Xcode from the Mac App Store, which is the recommended way for beginners. For any reason you don't want to use Mac App Store, you can download Xcode 9 manually. To get a copy of it, you have to sign into the Apple Developer website (http://developer.apple.com/register/). Select Download Tools and then click Download Xcode 10 GM.

Once the file is downloaded, double-click and install it.