Downloading Old iOS SDK Documentation

I recently did a clean install of Xcode 4.6.1 on a new Mac and found I was missing some of the earlier iOS 4.x and 5.x documentation sets. This post shows how to get that older documentation back should you need it.

Xcode Documentation Sets

Xcode Documentation Sets (“docsets”) are packaged as standard OS X bundles and updated via an RSS or Atom feed. It is beyond the scope of this post but you can find more details on how to integrate your own documentaion with Xcode in the Apple Documentation Set Guide.

A clean install of Xcode will download and install the docsets for the current versions of iOS, OS X and Xcode. For example, Xcode 4.6.1 which is the current version available in the Mac App Store at time of writing includes feed subscriptions to the docsets for iOS 6.1, OS X 10.8 and Xcode 4.6:

The documentation for the most commonly used iOS and Mac OS X developer libraries can be downloaded and installed from the Downloads pane of the Xcode preferences (⌘,).

Unfortunately since in my case I have recently done a clean install on a new machine I am missing some of the earlier iOS 4.x and 5.x documentation sets.

Adding Old Docsets to Xcode

As long as you know the URL of the docset feed you need it is easy to add it back to Xcode. If you have access to an older install of Xcode on a different machine which has the missing docsets you can use it to find the feed URL’s. Luckily even if you cannot find the feed you need on another installation it is not too difficult to guess the URL.

From the Documentation tab of the Xcode Downloads preferences pane you can check the URL of a selected docset in the lower information window. In the example below I have highlighted the feed URL for the iOS 6.1 docset:

The following URL’s cover the most common iOS docsets (I have shown them as http:// but you can also specify https:// or even feed://):

To subscribe to a docset you need to use the small “+” button in the middle of the window (see previous screenshot). Copy and paste the required URL into the dialog and click the Add button. You should then see the new feed in the list of docsets and you can click the Install button to download it.

Manually Download a docset

If for some reason you want to download the docset without using Xcode you can manually fetch the feed and use it to get the direct URL to the docset archive. For example to manually retrieve the iOS 4.3 docset, first retrieve the atom feed using curl and grep for the link elements in the feed (note that I am using https as the http link is actually just a redirect):

$ curl | grep link
  <link rel="self" href=""></link>
  <link rel="enclosure" type="application/octet-stream" href="" length="477703763"></link>
  <link rel="enclosure" type="application/octet-stream" href="" length="229887175"></link>

In this case the last update to the docset in the feed was on 2011-07-20 so we can retrieve that XML archive file:

$ curl -o AppleiOS4_3.iOSLibrary.xar

To get the docset file package uncompress the archive using the xar command:

$ xar -xf AppleiOS4_3.iOSLibrary.xar

If you want to view the resulting docset package in Xcode you will need to move it to the Xcode docsets directory at the following location:


Uninstall Old Docsets

Searching for a class or framework in the Xcode organiser can be confusing when you have lots of old documentation installed. You can end up with at least one result from each version of the documentation which means you need to be careful that you are reading the latest version.

Unfortunately you cannot remove an Apple docset using the ‘-’ button in the preferences pane. If you want to uninstall an Apple docset you can instead manually delete the file from the Xcode DocSets directory. This is usually located under ~/Library/Developer/Shared/Documentation/DocSets. You can also check the location of a docset from the documentation tab of the Downloads pane in the Xcode preferences window. Select the documentation set you want to uninstall and look in the information area at the bottom of the window.

If you click on the installed location of the documentation set it will open in Finder with the doc set selected. Deleting the docset file will remove it from the system.

Note that Xcode does not provide a way for you to completely remove the feed subscription for an Apple docset. Once you have the deleted the documentation set the “Installed” status will change back to an “Install” button which is useful should you need to download it again in the future. It does however mean that you end up with an ever longer list of historical documentation feeds.