Xcode 9 - Could not attach to pid for Frameworks unit tests Xcode 9 - Could not attach to pid for Frameworks unit tests xcode xcode

Xcode 9 - Could not attach to pid for Frameworks unit tests


After opening a bug report to Apple, they suggested me to:

  • Check if my user is an Admin user. It was the case.
  • Check if I have "_developer" group, in the output of groups command. it was the case. Use this command: dscacheutil -q group
  • Check developer mode rights using the command sudo /usr/sbin/DevToolsSecurity -status. The status was unknown for me.
  • Enable developer mode rights if needed, using the command sudo /usr/sbin/DevToolsSecurity -enable. This solved finally my issue!


If you have Mojave OS then:

1) Open your target scheme

enter image description here

2) Uncheck this one

enter image description here

3) Select this scheme while testing this target (ex. Testing "TestApiTarget" - select "TestApiTarget" in schemes on tests).

Its temporary solution from bug report


I was able to resolve this issue by:

  1. adding Single View App target (I named it HostApp)
  2. setting HostApp target as a host application for test target

Setting HostApp as a host application