Xcode, iOS SDKs, and iOS Simulators for CI Systems

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

Xcode

From the Mac App Store

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

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

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

Infrastructure Engineer @ Shopify

Infrastructure Engineer @ Shopify