Archive for January, 2017

Mac Code Signing Hell

Tuesday, January 10th, 2017

Recently I got a text message from a friend and a long-time customer saying that when he launched MailSteward, an error message appeared saying that “MailSteward is an application from an unidentified developer”.

MailSteward is a Mac application that has been developed, maintained, upgraded, and successfully distributed on the internet for the past twelve years. Now he had to bypass the OS X Gatekeeper security in order to launch it.

This was news to me.

I have been using the latest Xcode for development. I have the box checked to “Automatically manage signing”. When I archive to produce a signed copy of the latest version of MailSteward, it compiles and links without any error messages. I have assumed that all was well.

Apparently MailSteward has not been properly signed since the introduction of MacOS Sierra (10.12), which may account for a sudden, significant drop in sales since Apple released Sierra last Fall.

I immediately ran the codesign utility in a terminal window to check the validity of MailSteward’s signing. It passed with flying colors.

I then ran the spctl utility just to make sure, but it returned “rejected”. I ran it in verbose mode, but “rejected” was all it would say.

I spent the rest of the day googling for suggestions, trying different options in Xcode and repeatedly running spctl — being rejected over and over. I finally hit on the magic combination of parameters that persuaded spctl to grudgingly yield the elusive “accepted” response.

The first thing I did was uncheck the “Automatically manage signing” box. Then I set out to choose the right combination of Provisional Profile, Team, and Signing Certificate. Don’t ask me what those things are. I have never been able to understand any of the Apple documentation explaining them.

The right combo must be chosen, not only for the application itself, but also for any embedded projects within the main project, such as one I use in MailSteward called MailCore.

Once I managed to get MailSteward accepted by spctl, I then had to do the same for MailSteward Lite and MailSteward Pro, each of them, though sharing a common code base with MailSteward, required different settings in order to be rendered acceptable.

Code signing Mac applications is one of the great mysteries, like the virgin birth and string theory. Release from code signing Hell is only possible through grace.