Setting up Xcode 9 Server


#1

With Apple’s latest developer tools release Xcode 9, the gap to big CI platforms like CircleCI, TravisCI or Bitrise has been improved upon. The Developer Tools team has been hard at work making the stand alone service a lot better and easier to setup by dropping the macOS Server dependency.

The remote setup

Due to the simplistic setup getting started is really easy and can be done within a couple of hours.

The first thing you need is a Mac where your builds can run so that you can simply push new commits to your repo and go back to fixing bugs or wrenching on new features.
After you’ve signed up for a Mac with MacStadium you need to download Xcode 9 either from the Mac App Store or through Apple’s Developer website.

Once you’ve downloaded Xcode 9 and unpacked the special .xip file you can open Xcode in order to have put all of it’s dependencies like command line tools and SDKs in the correct places.

Since Xcode Server no longer depends on macOS Server you can simply go into Xcode’s settings and click on Server & Bots. Once you enabled the Xcode Server through the toggle in the upper right corner and entered your user’s password Xcode will setup everything needed to be accessible from your copy of Xcode running on your development machine like SSL certificates for secure communications

and the API server allowing you to kick of new builds on the remote Mac in one of our datacenters.

Once the modal dialogue disappears you’re setup. There are more options for you to checkout but the defaults should suit everyone well out of the box. Since Xcode 9 Server is now successfully setup you can close the Remote Desktop session and focus entirely on your local copy of Xcode.

The local setup

Open Xcode’s settings and navigate to the second tab called “Accounts”.


There you click the plus in the bottom left corner and then select Xcode Server.

You will be asked to enter an IP address, which you can find in your installation confirmation E-Mail from MacStadium.


(You can also use a DNS queryable URL if you’ve for example added a subdomain to your TLD with your Mac’s IP address like ci-mini.example.com)


Once you’ve provided the correct credentials and hit Add the dialogue box will disappear and more information about your version of Xcode Server will be displayed, like the API Server version and available SDKs for iOS, macOS, tvOS and watchOS.

Setting up a Xcode bot

Now that you’ve setup the build server and added it to your Xcode account you can go to Products -> Create bot in the status bar.

You’re able to provide a name to your Xcode Bot allowing you to distinguish between multiple bots for different jobs.

In the next steps the of the Xcode bot creation it will take you through the version control or source control settings of your bot and will allow you to define the build configuration.

Another great feature of Xcode bots are the possibility to have certain ones run at certain times every day allowing you to create a bot for example that pushes out a new beta build of your app to beta tests at night automatically.

If you prefer to have tests run on certain simulators you can either have it test your application on all available iOS simulators or define certain ones that it should test with.

The following step asks you to decide wether you’d like Xcode to manage it’s own certificates or if you’d like to provide certain Development and Distribution certificates and the matching provisioning profiles.

After you’ve decided on how to have Xcode Server sign your application it allows you to pass custom arguments to xcodebuild, the command line tool which will build and test your application.
(In order to learn more about xcodebuild open a terminal window and type man xcodebuild)

You’re also able to run custom scripts before and after the build. These can be used to setup dependencies like git submodules or to trigger a package manager.

Once you’ve set everything up the way you’d like it you can view your Xcode Server bot and it’s results in the Report navigator of your Xcode projects sidebar.

Getting started with Xcode Server has never been easier if some effort is put into it upfront. Beta tests and release overhead can be decreased greatly, giving you more time to focus on your apps code and shipping new features quicker.
Due to the first party integration into your development environment Xcode Server is sleek and gives you the ability to get everything done from writing code to automatically releasing it to your users from your native IDE without the need for another dependency or a website that you have to visit.


Ways to use your Mac server