Xcode, iOS SDKs, and iOS Simulators for CI Systems

Julian Nadeau
3 min readApr 10, 2016

This article assumes you’ve read the main article already.

Given that Xcode is required for iOS, both Xcode and iOS SDKs are important for an iOS CI System, but they’re not the easiest tools to install. Xcode is approximately 10GB in size, with each SDK being about 1.5–2GB a piece. While this normally doesn’t cause much issue, when you’re transferring that over a network (to get a VM onto a host machine) it really slows things down. There are also some non-obvious automated methods involved with handling and installing iOS SDKs that we’ll talk about.

In this article, I’m going to present some scripts and options on how to automate this work and make it easy.

Xcode Command Line Tools

For a number of developer tools within Mac, Xcode Command Line Tools are required.

Xcode

To test and develop for iOS, Xcode is required. We’ll talk about a few ways to install it (and one way in which you should never install it!).

From the Mac App Store

The Mac App Store provides you with the opportunity to install the latest signed and guaranteed Xcode version. This is great as you do not want to accidentally install a Malware infested Xcode, like that distributed in China.

Assuming you have Homebrew installed (see this article for details), you can install Xcode using MAS. This allows you to install tools from the Mac App Store directly.

brew install argon/mas/mas
mas install 497799835 # 497799835 is the Mac App Store ID for Xcode

There is a caveat — you need to sign into your Apple ID first. Luckily, MAS provides a command line tool for that

mas signin mas@example.com "My Password"

From a URL

This is significantly faster than the Mac App Store. Xcode seems to be very slow to download from the App store, as evidenced by the numerous 1-star reviews complaining of this fact.

The other option is to link directly to a DMG of Xcode. It is very important that you link directly to a version of Xcode that you control and that you obtained from Apple Developer Centre. I suggest downloading the DMG from Apple for the version of Xcode you need and hosting it on local servers or on a remote file server like Amazon’s S3 Service.

The code below assumes you are installing from a URL. You can install from a local DMG by using the install_dmg function directly.

iOS SDKs and Simulators

iOS simulators can be installed into a specific location in which Xcode expects them to be located.

/Library/Developer/CoreSimulator/Profiles/Runtimes/iOS [version].simruntime

In the code below, make sure you uncomment the simulators you need. Keep in mind that simulators are large and so you should try to keep only the simulators that you actually need.

The second file in the gist will create the simulators in Xcode and get them ready for use by your CI.

That takes care of the main tools of the trade (Xcode and iOS) for use in an iOS CI compute cluster. If you have any questions or suggestions, share them with me in the comments. Next, we’ll go over Ruby, Gems, and Homebrew.

--

--