Why does clean C++ sandbox app crash before reaching main?

I have a sandboxed C++ console app that crashes before reaching main.

I can reproduce the problem by starting a new, empty console application. It crashes without any changes after I select it to be a sandbox app.

I have looked at this (Sandbox activated macOS application crashes immediately after execution) thread and this (Receiving this error 'EXC_BREAKPOINT') one but neither seem to be related, or give any clues.

My crash log (attached) mentions "Unable to get bundle identifier for container id". I've added a Info.plist but it made no difference.

What is causing this?

Accepted Reply

There’s a tonne of background to this in my Resolving Trusted Execution Problems posts but, in short, you can’t sandbox a command-line tool. It’s called App Sandbox for a reason.

Why are trying to accomplish here? Why are you trying to sandbox this tool?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Replies

There’s a tonne of background to this in my Resolving Trusted Execution Problems posts but, in short, you can’t sandbox a command-line tool. It’s called App Sandbox for a reason.

Why are trying to accomplish here? Why are you trying to sandbox this tool?

Share and Enjoy

Quinn “The Eskimo!” @ Developer Technical Support @ Apple
let myEmail = "eskimo" + "1" + "@" + "apple.com"

Thank you.

Afraid the error must have been between keyboard and chair. I got the error on an existing, older project. Then I created a new, clean C++ project and it did the same. Not sure what I managed to do to enable sandbox for a console app, but I thought it was the default setting, hence the question. I just tried reproducing it again just now, and could not. When I created a new app, I got the clean "Hallo World". So seems it was just an error on my side.

At least I learned something - thank you for that.