Xcode 9: Could not attach to pid

Krunal picture Krunal · Jun 20, 2017 · Viewed 35.6k times · Source

I've been facing an issue (frequently) with the recent major release of the iOS application development tool - Xcode 9-beta.

It's showing me the following error frequently while running/debugging app in Simulator (iOS 11).

Could not attach to pid : “2370”
Ensure <project title> is not already running, and <system username> has permission to debug it.

Here is a snapshot for the same issue:

error message - Could not attach to pid

What would be permanent solution of this issue, as it's disturbing frequently?

Answer

ninja_iOS picture ninja_iOS · Oct 17, 2018

If issue is on OS Mojave and you are trying, like me to run tests on older Xcode version (lower than 10.0), make sure that in your scheme, when you select Test, Debug executable is disabled

enter image description here

You won't be able to debug tests from this point