App wont run in Xcode : Message from debugger: unable to attach

I am unable to run any of my MacOS projects in Xcode 9.2 after taking a break of a few months. I can run the app in Xcode 10 on a different drive.

When i try to run an app it compiles and says running then immediately says "Finished Running" and the debugger says "Message from debugger: unable to attach"

I can create an IOS app and run that in a simulator, its just MacOS apps, old or new.

Ive searched the net and found this problem but no solution. I really dont want to swap onto my other drive and upgrade at this moment.

Xcode 9.2 after taking a break of a few months

We are now Xcode 13. So 9.2 is really old now.

Which MacOS version ? Maybe Xcode 9.2 is not compatible with your OS version.

Could you at least upgrade to Xcode 10 ?

See here for download:

h t t p s : / / xcodereleases.com

How I fixed it by mistake.

I found out I could run xcode 9.2 on a new drive and compile and run the same code fine. It looked like there was some issue with certificates, I deleted all my certificates on developer.apple.com and a made a new one ( a Mac Development Certificate ) but this didnt work when I tried to use it, same problem.

In Xcode, I went into preferences->accounts->Manage Certificates and created a Developer ID Application certificate.

I went into the apps target->general code signing and changed the Signing Certificate to this one. It now compiles and runs fine.

I know this isnt a proper solution and will do a clean install in a new drive soon, but at least I can carry on coding and it might help someone else figure out the exact problem.

App wont run in Xcode : Message from debugger: unable to attach
 
 
Q