Step1: Download the latest version of XCode from https://developer.apple.com/download/
Step 2 − Click Download button to brdownload XCode file.
Step 3 – Unzip and install XCode.
Step 4 − There will be two items in the window that's displayed namely, XCode application and the Application folder's shortcut.
Step 5 − Drag the XCode to application and it will be copied to your applications.
Step 6 − Now XCode will be available as a part of other applications from which you can select and run.