I am developing a simple tool in C, and am using assertions for testing. Since I upgraded to macOS v13.0, whenever I run my test suite, I get lots of “programme name quit unexpectedly.” dialogue boxes – one for each assertion that failed –, which is quite annoying. Does anybody know whether, and how, those dialogue boxes can be turned off?
I considered whether this question should go on StackOverflow or here, but ultimately it’s about how to disable a macOS dialogue box, not about development; this is just for context. If I’m wrong, I’m happy to ask my question over at StackOverflow instead.
The Problem
The assertions that fail call abort, which raises an ABRT signal, triggering an abnormal exit and consequently the dialogue.
For example:
$ cc -xc - <<EOF
#include <stdlib.h>
int main(void) {
abort();
}
EOF
$ ./a.out
triggers
But one of the things that my test suite is testing for is whether the assertions catch the errors they should be catching; those assertions fail on purpose. So it’d be great if I could disable that dialogue box, preferably only for my test suite or only while testing.
Research
The manual for abort states that:
The abort() function causes a report to be generated by
Crash Reporter. If you wish to terminate without generating
a crash report, use exit(3) instead.
So there may be no solution.
I tried defaults write com.apple.CrashReporter DialogType none, which reads as if it would disable the Crash Reporter, but to no avail.
I also searched the web, but when my search terms include "Crash Reporter," the only advice I get is to disable sharing crash data with Apple (which I already did); and when they don’t, whatever advice might be out there is buried under an avalanche of articles on how to keep this-or-that application from crashing.
Non-solutions
I suppose, I could re-define assert or catch the ABRT signal and call _exit from the signal handler, but doing either is bad style, and I’d rather not.
![How to disable the “[…] quit unexpectedly.” dialog in macOS v13 (”Ventura”)? How to disable the “[…] quit unexpectedly.” dialog in macOS v13 (”Ventura”)?](https://i.sstatic.net/PUPVVm.png)
