What to do when an app crashes as it opens

Perhaps the most frustrating app crash is one that happens as the app tries to open. Before it has even had a chance to display its menu bar or splash screen, it has vanished, leaving you without a clue as to why. Surely the developer didn’t release an app that couldn’t even run? Where do you look for clues as to what happened when the app was only there for a second? Fortunately, this is one of the few situations where examining the crash log can be useful, and could solve the problem.

Common causes include:

  • the app was intentionally crashed by macOS because of an error in code signing, or another serious security failure;
  • the app failed because it was in translocation;
  • the app failed to open a document that is damaged or incompatible;
  • the app had a problem with its Preference settings file.

Signs and logs

Depending on the type of Mac, the version of macOS it’s running, and the nature of the crash, you may see nothing at all, a simple notification, or a full crash report.

crashreport2

crashreport1

While panic logs can be impossible to recover if you miss them, app crash reports are almost invariably saved to disk, normally in the path ~/Library/Logs/DiagnosticReports, although in some cases you’ll have to look a bit harder there, or in /Library/Logs/DiagnosticReports. As the report’s name should start with the app name, they’re easy to identify, and double-clicking them opens the report in Console (one of its few good uses).

Reading the crash log

In the upper ‘translated report’ look for the following:

  • Path – check whether this is a long semi-random path typical of app translocation.
  • Code Type – on an Apple silicon Mac, check whether the app is running native on ARM, or translated by Rosetta 2.
  • Exception Type – this could be EXC_BAD_ACCESS (SIGKILL (Code Signature Invalid)) if macOS has crashed the app because of a code signing problem.
  • Termination Reason – this may be given as Namespace CODESIGNING, Code 2 Invalid Page or similar for code signature problems.

An exception type of EXC_CRASH (SIGKILL) indicates macOS terminated the app, and its crash report should give a Termination Reason with a code explaining the reason for the crash. Apple silicon Macs running recent versions of Ventura are less likely to crash apps with signature problems, as they now tend to handle these by showing a dialog reporting that the app is damaged and offering to remove it. Intel Macs remain more likely to crash the app and leave you to discover why.

If you want to learn more about crash reports, they’re well documented for developers, starting from this master page. Worth reading are:

Code signing errors

If you’re absolutely certain that the app doesn’t contain any malicious code, you may be able to work around code signing errors by re-signing the app. I stress again that doing this to an app which might be malicious would be extremely dangerous, and you must ensure that you’re not going to invite security problems by doing so.

Before proceeding any further, you’ll need to add Terminal to the list in System Settings > Privacy & Security > App Management, otherwise your commands will be unable to make any changes to the app. Once you’ve done that, open Terminal and use the command
codesign --remove-signature MyApp.app
to strip the existing signature from the app MyApp.app. Note that two hyphens precede the remove-signature verb.

When that’s done, use the command
codesign --sign - MyApp.app
to sign that app with an ad hoc signature.

If that’s not successful, you’ll need to refer the problem to the app’s developer, who should in any case be informed of any problems with their app’s code signature or security checks.

App translocation

There are some circumstances in which perfectly good apps may prove unable to run as expected when they’ve been translocated. As app translocation becomes more common in Ventura, you may encounter such a problem. Once again, before trying any workaround, you must have total confidence that the app isn’t malicious, or you will make your problems worse.

To make translocation less likely, you can strip any com.apple.quarantine extended attribute using xattred, and move the app (and the app alone) into the main Applications folder. You should also inform the developer of the problem.

Failed to open document

If the app was last quit with a document still open, and that document now has a serious incompatibility with the app, that can cause the app to crash when it’s next opened, and tries to re-open that document. The same effect can occur when an app is opened by opening one of its documents. Try opening the app alone before opening the document. If necessary you can enable Close windows when quitting an application, in System Settings > Desktop & Dock, or move the offending document to a different volume.

Preference file problems

Most apps that use Property List files stored in ~/Library/Preferences, or an equivalent in the app’s folder in the ~/Library/Containers folder, need to open that preference file during app startup. If that preference file is malformed or corrupted, it can cause the app to crash when it tries reading it. This may not be easy to recognise in a crash log, although references there to cfprefsd, the path to the preference file, or UserDefaults are useful clues.

The best way to address this is to locate and trash the preference file, restart, inspect the location of the former file and trash it again if it has reappeared. When next started, the app should be able to create a fresh default preference file, and open normally again.

Other causes

Most other potential causes tend to prolong app opening rather than causing it to crash. Apps that check for updates over the internet usually do so soon after opening, but should perform that check without blocking or crashing the app. Similarly, apps that require to connect to an external authorisation service more usually hang, leaving their Dock icon bouncing indefinitely.

A damaged or incompatible app may well crash during opening. If you suspect that, check with the app’s support site that the version you are trying to run is the latest that’s compatible with your Mac and macOS. If in doubt, re-install the app.