Sunday 19 March 2017

Downloading Apple simulators manually

The other day I decided to download the latest tvOS simulator but the download via Xcode kept failing! I decided to try and download it manually. After a quick google I found that the URL of the download was displayed in the system console the you cancelled the download.

After copying the download URL into Safari, and also using curl via the command line, I had no better luck :(

To get the download to work successfully I found that I had to change the URL from https to http and it just worked! :)

The steps I followed are:

  1. Open XCode, open preferences, go to the Downloads section.
  2. Open the Console App, clear the console for your device (not strictly necessary but makes it easier to find the URL later).
  3. Go back to the XCode preferences. Start the simulator download, then cancel it.
  4. Now in the Console, you will see something about the cancellation with the download URL.
  5. Copy the URL from the Console. Then in Terminal in some suitable directory, download it: 

    curl http://[the url you copied] -O -R 
    (the letter O, not a zero)

  6. Finally, copy this file to ~/Library/Caches/com.apple.dt.Xcode/Downloads
  7. In XCode, in the Downloads section, start the Simulator download again, it should find the file you downloaded and install it.

Example:
robs-macbookpro:~ rob$ curl http://devimages-cdn.apple.com/downloads/xcode/simulators/com.apple.pkg.AppleTVSimulatorSDK10_0-10.0.1.1474488730.dmg -O -R
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 1073M  100 1073M    0     0   601k      0  0:30:25  0:30:25 --:--:--  565k
robs-macbookpro:~ rob$ cp com.apple.pkg.AppleTVSimulatorSDK10_0-10.0.1.1474488730.dmg ~/Library/Caches/com.apple.dt.Xcode/Downloads/