Blog

Apple Silicon + Screen Capture = 💥

Recently several Mac users reported crashes whenever they tried to capture their screen using nut.js. At first I suspected a one-off error, and I also wasn't able to reproduce the issue. But as more and more users started reporting the same issue, I started to collect some more information.

So, I tried to reproduce the issue on both my Intel MacBook Pro and my Apple Silicon Mac Mini, but on both systems everything worked as expected. Since all reports were coming from Apple Silicon Macs, I neglected my Intel machine and focused on the Apple Silicon one. However, I was still unable to reproduce the issue.

And to make matters worse, people started reporting that the issue did not occur on macOS Monterey, but only on macOS Ventura. An issue that only occurs on a particular piece of hardware and only on a particular operating system version... Great... To put this into perspective, two month had already passed until I had enough data to draw this conclusion.

But how to deal with that?

Well, some of you might have already noticed that I'm pretty serious about my work on nut.js and I didn't want to leave this rather big issue lingering around until it might disappear on its own. Call me crazy, but I ultimately replaced my M1 Mac Mini with an M1 MacBook Pro and started digging.

With this new machine I was able to gather detailed data, showcasing that the issue was indeed only happening on Apple Silicon Macs running macOS Ventura. I created a small demo project that would reproduce the issue, subscribed to the Apple developer program and filed a bug report.

Ok, so there's now a bug report to get this fixed, but what about the users who are affected by this issue until it get's (hopefully) resolved? Now that I knew where the problem originated from I tried to work around it. And fortunately, I was able to find a partial solution which is now available in the latest snapshot version of nut.js.

So for now, I suggest to use the following workaround:

  1. Install the latest snapshot version of nut.js: npm i @nut-tree/nut-js@next
  2. Do not apply any scaling, but keep your screen resolution at the default

This should mitigate the issue for now and I'll keep you updated on the progress of the bug report.

Thanks again!

I'd like to thank all project sponsors once again!

As you can see, I'm really serious about my work on nut.js and I'm doing my best to keep it up to date and to address any issues that might arise. From time to time, this gets pricey, so your sponsorship is highly appreciated!

Simon

Previous
Searching for the root cause of broken screen capture on macOS Ventura