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

  • Also happens on a brand new M1 Max with the latest stable OS (12.12.1) and XCode (13.2.1) when creating a completely new Watch App.

  • happening for m1 pro and debugging a desktop app with xcode 12.3. I have tried all solutions mentioned in this thread but to no avail. I am able to to atttach it after edit Scheme -> Run -> Debug executable but i have the need to debug the app. any suggestions are welcome.

Add a Comment

Accepted Reply

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


sudo DevToolsSecurity -enable

Add a Comment

Replies

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

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


sudo DevToolsSecurity -enable

Add a Comment

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 !

  • This worked for me.

  • THANKS! THIS DID THE TRICK

  • This fixed my problem. I'm working on a MacBook Air M1. Thank you!

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.