I cannot run tests in Xcode when working on a pure SPM package, testing on Mac (macOS 13).
Running the tests of the package with swift test in the Package root folder works!
Only Xcode testing of the the Swift package does not work properly.
It fails telling me:
[loading] Cannot find executable for CFBundle
The bundle “<test target name>.xctest” couldn’t be loaded because its executable couldn’t be located. Try reinstalling the bundle.
When I look at the output in DerivedData I can see all the binaries and bundles having been created.
Somehow Xcode doesn't have the correct rights to be able to load these bundles.
Steps to reproduce:
- create a brand new package from Xcode
- run
CMD + uto run the tests (make sure the selected device isMac(your machine))
⚠️ The tests fail with the before mentioned error message. ⚠️
System information
- Macbook Pro M1
- macOS Ventura (13.4.1 (22F82))
- Xcode 14.3 (14E222b)
I found a solution to the problem, because I was thinking about the "rights issue" that Xcode might have.
Enabling
Full Disk Accessfixes the problems!Just go to
System Settings on macOS > Privacy & Security > Full Disk Access > Add Xcode to the list and enable the switch