Xcode: Could not attach to pid

Every single time I try to launch the simulator I get this:


Cold not attach to pid : "12345"

Domain: IDEDebugSessionErrorDomain

Code: 3

Failure Reason: Error 1

--

Error 1

Domain: IDEDebugSessionErrorDomain

Code: 3

--


I'd REALLY like to be able to debug. Can anyone offer some help?


On google, I found suggestions to build it again, to restart xcode, to restart Xcode and rebuild, to reboot the computer, to set to release instead of debug. NONE of thelse things helped in any way. 😟


-Verxion

Answered by Hunter in 373436022

It's an issue with authorization. Try this in the Terminal:


sudo DevToolsSecurity -enable

Also tried resetting all content and settings in the simulator. Didn't help.

Accepted Answer

It's an issue with authorization. Try this in the Terminal:


sudo DevToolsSecurity -enable

23

THAT FIXED IT!!!!


THANK YOU THANK YOU THANK YOU!


For this entire time I've had to do 100% of my development without the simulator. This finally allows me to debug! So very thankful for the help. 🙂


-Verxion

Awesome! Thanks!

I'm still getting this error even after I do the "sudo DevToolsSecurity -enable" I've tried rebooting my mac, Xcode, and doing command+shift+k and none of it worked. Any help would be appreciated!

Edit Scheme -> Run -> Debug excitable

uncheck this checkbox it will be ok !

30

Thank you so much. This helped me.

it works,but make debugger disable and than could not debug code.

So, I have the same exact issue when attempting to build to a device.


--

process launch failed: failed to get the task for process 2834

Domain: IDEDebugSessionErrorDomain

Code: 3

--


App will build and attach to simulator, but will not build and attach to device.


I can do Edit Scheme -> Run -> Debug executable == false


And it will then build to a device, but w/o debugger support.


Executable == true gives the above error.


sudo DevToolsSecurity -enable does nothing either way.


Should note that this is app secific. If I run up a new demo app it will build to the device just fine.

For me, it was a spotty internet connection. Once the connection was stable, no problem occurred when rerunning the app. I made no setting changes.

any solution for this? this happens with me when I connected with LAN connection without internet connection. and when i connect with internet Wifi the Simulator runs my app.

if any one sees like the following messages on 11.M.N of Xcode --


error: attach by name 'processname' failed -- Problems with launching via XPC. XPC error : Connection interrupted


You know that the process had a crash in your prior debug session.


Until I reboot the machine, I can not re-attach to the same process -- what a bummer :-(

Still getting the same issue with 12-beta-2.
got this on xcode 12 verison
I have this same problem but macOS (11.1) Xcode 12.0 (17219); which begin on Big Sur in app review, and since I updated and trying to triage what's new / different / required.

Trying to launch host app via custom URL.
Xcode: Could not attach to pid
 
 
Q