Man this new MacBook Pro is nice. It’s light, fast, cool, sharp, and its keyboard is the best of the “flat” variety. Even the TouchBar is surprisingly useful.

But what’s this? Whenever it woke from sleep, some apps almost always crashed, including my own RegExRX. What’s that about?

As of MacOS 10.12.2, there seems to be a bug in the system software that handles the new TouchBar. I don’t know the details beyond that it affects “older” software, i.e., stuff that hasn’t been compiled recently, but I did learn of a workaround courtesy of our friends at Red Sweater Software.

Disclaimer: Even though what I’m about to suggest seems harmless, I can’t vouch for any side-effects. I can only tell you that it’s worked for me.

The Symptoms

On a new TouchBar-enabled MacBook Pro, one or more apps crash on wake with a report that looks like the one below. In the report, under “Application Specific Information”, you find the line objc_msgSend() selector name: actionForLayer:forKey:.

The Workaround

If the offending app is running, quit it.

Look at the report and find the application’s bundle identifier on the line labeled “Identifier”. In the sample report below, it is “com.somecompany.someapp”. (Note that, while not common, the identifier might have spaces in it.)

Start the Terminal app from /Applications/Utilities and type the following at the prompt, substituting the sample identifier with the one you found above:

defaults write 'com.somecompany.someapp' NSLayerPerformanceUpdates -bool YES

and press Return.

That’s it. Repeat for every app that has this issue.

Finding The Crash Report

If you closed the crash report, you can find it by starting Console in /Applications/Utilities and navigating to the “~/Library/Logs” section. Turn the arrow down and highlight “DiagnosticReports”.

Sample Crash Log

This is an example of a crash log. The key element here is the “Application Specific Information”, objc_msgSend() selector name: actionForLayer:forKey:.

Process: SomeApp [26299]
Path: /Volumes/VOLUME/*/SomeApp.app/Contents/MacOS/SomeApp
Identifier: com.somecompany.someapp
Version: 1.8.1 (1.8.1.3.0)
Code Type: X86 (Native)
Parent Process: ??? [1]
Responsible: SomeApp [26299]
User ID: 501


Date/Time: 2017-01-05 15:01:59.895 -0500
OS Version: Mac OS X 10.12.2 (16C68)
Report Version: 12
Anonymous UUID: BCF7AA30-5988-FF2B-1E54-791B51FF135B


Sleep/Wake UUID: 04B377C8-08D8-4B41-B7BB-0B3A169D7D60


Time Awake Since Boot: 22000 seconds
Time Since Wake: 9 seconds


System Integrity Protection: enabled


Crashed Thread: 0 Dispatch queue: com.apple.main-thread


Exception Type: EXC_BAD_ACCESS (SIGSEGV)
Exception Codes: KERN_INVALID_ADDRESS at 0x00000000355fb3d8
Exception Note: EXC_CORPSE_NOTIFY


Termination Signal: Segmentation fault: 11
Termination Reason: Namespace SIGNAL, Code 0xb
Terminating Process: exc handler [0]


VM Regions Near 0x355fb3d8:
MALLOC_LARGE 0000000014175000-0000000014275000 [ 1024K] rw-/rwx SM=PRV
-->
Submap 0000000090000000-00000000a3800000 [312.0M] r--/rwx SM=SHM machine-wide VM submap


Application Specific Information:
objc_msgSend() selector name: actionForLayer:forKey:


Thread 0 Crashed:: Dispatch queue: com.apple.main-thread
0 libobjc.A.dylib 0x9ef29020 objc_msgSend + 32
...

[Written by Kem Tekinay]