Published on

How to download Xcode with aria2c

Authors
  • avatar
    Name
    Tong
    Twitter

2019 Update

If you use fastlane, you can download and manage Xcode versions by using xcode-install.

Why did 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 stable version from Mac App Store, and another way is download any version from Downloads for Apple Developers.

Install 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, a free account is okay too).

Copy that text, and save as cookies.txt:

cookies

To download Xcode 7.0 with aria2c, use this command:

aria2c --load-cookies=cookies.txt https://developer.apple.com/services-account/

Install Xcode

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 /Applications.

install

Fix permissions

If you installed a version from Mac App Store, and a version download from Downloads for Apple Developers, you may found these two versions are different owner and group.

ls -al /Applications/Xcode*/*
permissions

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 Downloads for Apple Developers, the result should be either

/Applications/Xcode.app: accepted
source=Apple

or

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

View on GitHubThis article is licensed under a CC BY-SA 4.0 license.