tldr: In order to keep the current Safari window open when you close the last tab, use tab groups.

Last month, I once again switched my default web browser to Safari. It has its quirks, but I missed it in a weird way.

I initially switched to Firefox because of its stellar support for vim keybindings and some other extensions I started to enjoy. Even with all those improvements, I began to miss some niceties that Safari has built-in.

With my current setup, I still use Firefox for some websites. Some sites are just hard to use without uBlock Origin. None of Safari’s content blockers match its performance.

I learned to live with all of Safari’s shortcomings, but there is one UX issue that keeps me up at night: The Safari window always gets closed when you close the last tab (⌘ + w). As of macOS 14, there seems to be no way to change this default behavior without introducing some other issues.

What irks me even more is that this behavior does not exist on iPadOS. On iPads, the ⌘ + w shortcut closes the open window only if the current window has a single empty tab. In all other cases, the Safari window will remain open.

What I’ve found recently is that this behavior is different for tab groups. When you close the last tab in a Safari tab group, the window will remain open. Since then, I created my “main” tab group:

Safari tab groups with the “main” tab group

This solution has the nice benefit of keeping all your current tabs in sync across all your devices. I know that by default you can still access all your open tabs from any device, but it was always an extra hassle for me to go through the “From <device_name>” section.