Why I wrote this?
Download Xcode from unofficial site may contains malware, like XcodeGhost.
So, we must download Xcode from Apple, there’s two ways to download Xcode, one way is download latest version from Mac App Store, and another way is download all versions from Downloads for Apple Developers.
Install Cookie Exporter for Chrome
After sign in with your Apple ID, export cookie as cookies.txt (You don’t have to enroll any program, a free account is okay too).
Copy that text, and save as cookies.txt:
To download Xcode 7.0 with aria2c, use this command:
aria2c --load-cookies=cookies.txt https://developer.apple.com/services-account/
Check shasum for Xcode_7.dmg
shasum Xcode_7.dmg 4afc067e5fc9266413c157167a123c8cdfdfb15e Xcode_7.dmg
To install Xcode:
Open Xcode_7.dmg and drag Xcode to
ls -al /Applications/Xcode*/*
To change owner to
root, group to
sudo chown -R root:wheel /Applications/Xcode*
To verify the identity
To verify the identity of your copy of Xcode run the following command in Terminal on a system with Gatekeeper enabled:
spctl --assess --verbose /Applications/Xcode*
The tool should return the following result for a version of Xcode downloaded from the Mac App Store:
source=Mac App Store
and for a version downloaded from Downloads for Apple Developers, the result should be either