TL;DR - Quick answer: System Preferences -> Mission Control -> (Uncheck) “Automatically rearrange Spaces based on most recent use"
Macs are beautiful machines. The attention to detail and ease of use is world-renowned. As a developer, I love that so many minor, and often annoying, details are taken care of for me, so that I can get back to what I most enjoy.
One of the more beloved features of these machines is the “multiple desktops” or “Spaces”. If you’ve ever seen users swipe left and right between apps using 3 fingers on the trackpad, you’re familiar. If you’re not, swipe up with 3 fingers on the trackpad (or press the F3 key) and then click the “+” sign at the top right of the screen. You’ve now added a new Space. These can be switched quickly between by swiping with 3 fingers in the direction of your new Space. You can also rearrange these in any order you see fit.
I’ll typically have at least 3 of these open if I’m away from my typical multiple monitor setup - one for music, my IDE, and a browser window. I’ve found this approach much more simple and clean from my old ‘everything open on the same screen days’. It’s nice to be able to quickly swipe one direction and change a song, quickly search documentation, etc.
Once you start becoming a heavier user of this feature, you might notice that you’ll switch between a Space, and it’s not the window you were expecting to see. Mac OS will automatically rearrange these for you based on how often you switch to a particular Space. A feature which is tragically enabled by default.
Here’s how to remedy this:
- Go the top left of your screen and click the Apple logo: ()
- Click “System Preferences”
- Go to “Mission Control”
- Uncheck that dastardly “Automatically rearrange Spaces based on most recent use”
- Enjoy Spaces as they were intended