Message from debugger: cannot attach to process due to System Integrity Protection in 10.13.6

I added mail.app as run executable in my bundle in Xcode Mac OS project and while running it, I see this error

"Message from debugger: cannot attach to process due to System Integrity Protection"

As suggested by many other developers I created a duplicate copy of Mail.app and placed it outside of the /Applications directory hierarchy, and set the scheme's executable to that duplicate app. As the copy of the app does not have SIP attributes, so Xcode can run it under the debugger.

But still the error is not eliminated

Accepted Reply

If you want to debug Mail then your best option is to disable SIP, as discussed in System Integrity Protection Guide. The alternative — making a copy of Mail and re-signing it as non-Apple code — is not viable for a product as complex as Mail, which uses all sorts of private Apple entitlements.

WARNING I never disable SIP on my production machine. I usually do this sort of thing in a VM, or on a ‘victim’ machine. If you must disable SIP on your production machine, remember to re-enable it once you’re done.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Replies

If you want to debug Mail then your best option is to disable SIP, as discussed in System Integrity Protection Guide. The alternative — making a copy of Mail and re-signing it as non-Apple code — is not viable for a product as complex as Mail, which uses all sorts of private Apple entitlements.

WARNING I never disable SIP on my production machine. I usually do this sort of thing in a VM, or on a ‘victim’ machine. If you must disable SIP on your production machine, remember to re-enable it once you’re done.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"

Disabling SIP worked for me but i want to know if there is any other alternative which works without disabling it

but i want to know if there is any other alternative which works without disabling it

The only alternative I’m aware of — copy the program and re-sign it as non-Apple code — is not viable for Mail because it uses a whole raft of private Apple entitlements.

Share and Enjoy

Quinn “The Eskimo!”
Apple Developer Relations, Developer Technical Support, Core OS/Hardware

let myEmail = "eskimo" + "1" + "@apple.com"