How can I stop OSX from combining spaces when I unplug a monitor?

When you connect/remove a monitor the first space on that monitor merges with the first space on your laptop. Leave the first space on your monitor empty forever and just have a second space. The second space will become a space on your laptop when you unplug the monitor and move back to the monitor when you plug it back it.

I have two monitors and my laptop. Each monitor has an empty space as it's first space. When I plug in my dock I have to swipe to a new space on each monitor, but it avoids all the merging.


The key is to keep "Desktop 1" (the first Space on your laptop) clear. The behavior seems to be that on unplug, the first Space on the monitor merges with the first Space on the laptop. So how do you keep it clear? Here's what I do:

I've assigned all my Login Items to "Desktop 2" on the laptop. You can assign an application to a space by:

  • Right-clicking on the application in Dock
  • Go to Options
  • Go to "Assign To" section
  • Select "Desktop 2" (might be "Desktop 2 on Display 1")

Now, when I login, all my initial applications automatically start up in Desktop 2, and all I have to do is remember to not mess with "Desktop 1". Then, when I unplug, the first Space on the monitor merges into an empty Space so there isn't any issues (other than resizing, but what can you do).

If you don't have any login items, I would recommend adding even just one that's assigned to "Desktop 2", so you naturally start at that Space, instead of forgetting and starting everything in "Desktop 1".

See also:

Maintain allocation of windows to spaces on restart and external monitor unplugging

Can apps on an external display be moved to a new space on disconnect?

How to prevent secondary display space from merging with laptop space in macOS?


Keeping an empty Space on laptop and both external monitors helped me part of the way with this issue but I was running into bizarre behavior where, when my laptop lid was closed, the Spaces I wanted on each of my external monitors were correct, but when I opened my laptop lid (as one must do from time to time to use the camera, unlock the computer after a while, etc) the Spaces would always swap monitors bizarrely. It wasn't the end of the world to go into Mission Control and drag them but it was a bit of a hassle and a mystery.

Ultimately I ended up figuring out that OS X had gotten the notion that when my laptop lid was open, my "primary" monitor was the 2nd external one, rather than the first. This meant that no matter how much dragging of Spaces I did, in this scenario the Spaces on my 2nd external were always called Desktop 1 and Desktop 2 and the Spaces on my 1st monitor were always called Desktop 3 and Desktop 4.

The solution turned out to be to drag the very thin little menu bar in the System Preferences -> Displays -> Arrangement screen from monitor 2 to monitor 1. This made all the difference and now the Spaces stay put on their proper monitors regardless of whether the laptop lid is open or closed. Hope this helps someone.

example