How to archive a macOS application containing multiple targets

Posted by Romain Pouclet on April 2, 2018

I recently reached a point with Commitment where I’m actually using it daily, which both feels great and terrible. Great because, well, it’s my own app, and terrible because I see all the quirks I need to fix. The last two sessions of work have been spent setting up Sparkle to auto-update the app. As I’m learning (and struggling) quite a bit, I figured I should write about it.

The application structure

My Xcode project contains 3 macOS targets: the main container, the editor itself and a very light command line tool. The main application contains the preferences panel, install the command line tool on the user’s computer and deal with all the auto-updating part. In the end, that’s the target I’m going to install on a computer.

This target has 3 dependencies - the 2 macOS targets and a framework that contains all the logic - and each are built as part of the main target’s build process.

Commitment Xcode project, showing 3 targets

At the end of the build process, the artifacts are embedded into the main target.

I got really confused when I realized that once I had archived my main application, the resulting archive wasn’t recognized as a valid macOS archive. Instead, it was all alone, sadly listed under the “Other items” section.

Xcode archives panel, showing Commitment in the wrong category

Getting a valid macOS archive.

Looking for macOS documentation is a very painful experience, because it assumes you were actually looking for iOS stuff. After some persistent digging, it turns out all it required was switching the “Skip Install” build setting to “YES” in the 2 targets that are not going to ship as standalone mac applications.

Xcode archive panel, showing Commitment in the right section

Success!