How do I use Xcode to codesign a command line utility I created with SPM?

24 views Asked by At

I created a command line utility using swift package init, and added swift-argument-parser as a dependency.

Steps:

  • Create a folder for my project and cd into it in terminal

  • Issue the command swift package init --type executable in terminal:

  • Edit the Package.swift file to add a dependency on swift-argument-parser. (Thie details of this step are beyond the scope of this question.)

  • Open the Package.swift file from the finder, or issue the command xed Package.swift in terminal. (Either approach opens my package in the Xcode IDE)

I have my command line utiliyt built, and now I want to code-sign it and distribute it. I'd like to sign it in xcode rather than signing it from terminal. How do I do that?

Apple has documentation on adding a certificate to an Xcode project and signing Mac code for distribution, but those docs assume a "normal" xcode project that has an xcode project file (.xcodeproj.) Projects build from an SPM Project.swift file don't have a .xcodeproj file, and so they don't present settings that you can edit.

I guess I could go back and recreate my tool as a normal xcode project, or figure out how to sign it from the command line, but I prefer to use the IDE where possible, and would rather not start my project over from scratch.

0

There are 0 answers