Hacking Gate


To dream and to build, To fail and to succeed.

How to download Xcode with aria2c

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 Apple's website

Export Cookie

Download Cookie Exporter for Chrome

Open Downloads for Apple Developers

After sign in with your Apple ID, export cookie as cookies.txt
(You don't have to enroll any program, just need a Free account.)

Copy that text, and save as cookies.txt:

To download Xcode 7.0 with aria2c, use this command:

aria2c -c -x10 -s10 --load-cookies=cookies.txt https://developer.apple.com/services-account/download\?path\=/Developer_Tools/Xcode_7/Xcode_7.dmg

Install Xcode

Check shasum of Xcode_7.dmg

shasum Xcode_7.dmg
4afc067e5fc9266413c157167a123c8cdfdfb15e  Xcode_7.dmg

To install Xcode:

Open Xcode_7.dmg and drag Xcode to Applications.

Fix permissions

If you install a version from Mac App Store, and a version download from Apple's website, you may found these tow version are different owner and group.

ls -al /Applications/Xcode*/*

To change owner to root, group to wheel:

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:
/Applications/Xcode.app: accepted
source=Mac App Store

and for a version downloaded from the Apple Developer web site, the result should read either
/Applications/Xcode.app: accepted


/Applications/Xcode.app: accepted
source=Apple System

comments powered by Disqus