How to code sign unit tests in a Swift Package for Mac Catalyst?

It appears that on an Apple Silicon Macs, we cannot do unit tests for Swift Packages using Mac Catalyst.

Steps to produce:
0. Get an Apple Silicon Mac.
  1. Go to an empty folder, create a new Swift Package using swift package init.

  2. Open the created Package.swift, select the running destination to be My Mac (Mac Catalyst).

  3. Run the tests.

I was getting the following error:

Code Block
code signature in [generated test path] not valid for use in process using Library Validation: Trying to load an unsigned library.

I did not get this issue on my Intel Mac. On Apple Silicon Macs, set the destination to an iOS simulator or a “pure” Mac destination also works.

How to bypass this issue, or is this a bug from Xcode? I am running the latest Xcode 12.3.

We have same issue. Did you send bug to Apple?

This is still happening to me in Xcode 13.1 and Xcode 13.2 RC.

My current workaround is to use Mac Catalyst (Rosetta) instead of just Mac Catalyst. Not ideal, of course.

How to code sign unit tests in a Swift Package for Mac Catalyst?
 
 
Q