For years, I’ve had a macOS bug that occurred randomly and that I could only fix by rebooting or logging out. The Internet is full of similar problems, but I never found a solution to mine, and my pleas for help on Twitter went unanswered. Now, I have found a workaround myself.

I always had a vague sense that web applications somehow trigger it, but I couldn’t ever nail it down, and even quitting all applications didn’t fix it. At least not always. It also occurred unpredictably: sometimes once per month, sometimes multiple times per day. I still don’t know what causes it, but I know how to fix it – until it appears the next time.

The Bug

When switching applications across desktops (for example, using ⌘⇥ or clicking an application icon), the window of the new application is taken away its focus after a few milliseconds. You can see how it very briefly has focus and then doesn’t. You must click the window or application icon to activate it again because no window has focus at that moment. I usually run into this when switching between Safari and my terminal, and it’s maddening.

The Solution

Tear out any tab from Safari to make it a window. In other words: click a tab and drag it down1.

Yes, I’m not kidding. Yes, it works 100% of the time – I’ve waited a few months and occurrences until I wrote this. It’s the only thing you have to do.

You can re-attach the tab to the original window afterwards; it will keep working.

Here’s to hope I’m saving someone hours of research and countless reboots. Please contact me if you know what’s causing this bug – it’s survived many updates and fresh OS installs alike.

Also feel free to let me know if you’ve suffered from the same bug! Only 50% of my co-workers were affected.

  1. I can’t tell whether it matters what window if you have more than one – I never have more than one Safari window open. Feedback appreciated! ↩︎