Mac: 3 monitor setup: My desktop set keep switching places between monitors
Solution 1
I "solved" this problem using https://github.com/jakehilborn/displayplacer. If I connect my hub and the monitors are incorrect, instead of having to rotate screens or reconnect cables, I can now run a script (via a hotkey) to resolve this.
First, make sure your monitors are in the correct configuration. Then install displayplacer and run it.
brew tap jakehilborn/jakehilborn && brew install displayplacer
displayplacer list
At the bottom of the output you'll see that it generates the command which will place your monitors back into the current configuration. Example:
displayplacer "id:C00DE6B5-2BF1-D707-8452-14BD6BFAAC84 res:1920x1080 hz:60 color_depth:8 scaling:off origin:(0,0) degree:0" "id:D0823E00-B252-0F5C-DE87-D142F95D0CB4 res:1680x1050 color_depth:8 scaling:on origin:(-1680,0) degree:0" "id:1A13BBCA-7176-912E-4048-7E7E22D786C2 res:1080x1920 hz:60 color_depth:8 scaling:off origin:(1920,-386) degree:90"
I then created a service/action and set a keyboard shortcut for this item. Now a quick keystroke will resolve the issue.
More info: The answer by Dan is the root of this problem for me. I have two identical monitors, both being connected to a hub via Displayport. That hub is connected to my mac via one USB-C connection. Randomly, the dock will load the settings in a different order which causes this issue. Since my 3rd monitor is rotated, this makes two screens now improperly rotated.
For months I have been disconnecting both DisplayPort connections on the hub, and then reconnecting in the reverse order. This solves the problem, but it was really annoying.
Solution 2
Yes! I have 4 external monitors and this drove me nuts until I figured it out. Play around with moving the "top" bar between screens in the Arrangement window. Assign it to different screens and you will notice it will solve your issue once you find the "right" screen. I can't remember why that worked, but it did.
Alternatively, you can also drag one of the Mac windows around and then let it drop back into place.
Solution 3
For me it's based on which cable I plug in first, even when I plug them into the same ports. I'm using two HDMI cables. If my screens end up swapped, I just unplug one of the cables and plug it back in. If the screens are still swapped, I unplug the other one and plug it back in. The screens will both flicker and they'll swap back to normal.
This seems like an OS bug, but I have no way of knowing for sure.
Solution 4
UPDATE - I figured out how to get this working by automating the rearrange displays menu bar system preference. Please view my solution from this thread. This solution is for ALL the peeps that have to manually change the menu bar in the displays system preference.
Unfortunately, I've tried all the solutions mentioned and the only thing that works for my computer (macOS 10.14.6 , MacBook Pro 15-inch, 2018, Radeon Pro Vega 20 4 GB – view screenshot) is opening Displays in System Preferences and dragging the menu bar through all the displays and ending back on the main monitor you started from. It's such a pain...
For those using the Keyboard Maestro method (and it works for you), but you use another shell like oh-my-zsh, you'll have an issue using the displayplacer
script because it's using bash instead of oh-my-zsh. There are 2 fixes for this that I've listed below.
Option 1: Export PATH in .bash_profile
- Edit your .bash_profile using your editor
- Insert
export PATH="$PATH:/usr/local/bin"
- Save file and restart Terminal or Keyboard Maestro
Option 2: Use absolute path reference
- Add
/usr/local/bin/displayplacer [enter_display_code]
to your Keyboard Maestro shortcut, e.g. view Keyboard Maestro screenshot
Solution 5
Apple Support helped me out with this:
- Go to the Finder (click on desktop) and then hover over the "Go" menu at the top of your computer screen
- Now press the "option" button while still hovering over "Go" and you will see the "Library" folder choice appear
- Choose "Library" by highlighting it.
- With the Library folder open in front of you, locate the "Caches" folder.
- Now drag it to the trash.
- Empty the trash.
- Restart.
Eureka! This solved this annoying screen switch problem for me in mission control, where my Mac desktops would automatically switch by themselves when working in one of the four open Mac desktops.
Related videos on Youtube
![Admin](/assets/logo_square_200-5d0d61d6853298bd2a4fe063103715b4daf2819fc21225efa21dfb93e61952ea.png)
Admin
Updated on September 18, 2022Comments
-
Admin almost 2 years
Situation:
I have a MacBook pro
MacBook Pro (Retina, 15-inch, Mid 2014)
And have 2 External Monitors
ASUS VS247 Display
connected via thunderbolt.On each monitor, I have multiple Desktops/Spaces open.
Problem:
When I wake my mac from sleep, sometimes, it switches the recognition of the monitors and all the Desktops/Spaces from Monitor2 are now on Monitor3 and all Desktops/Spaces from Monitor3 are on Monitor2.
The main monitor (the one on the laptop) always stays the same.
This happens on an average once every month. I was unable to find a specific cause for this to happen.
I have my thunderbolt cables and ports color-coded. So, I am definitely not switching the cables around.
More info:
This is how my mission control settings look like.
[NO] Automatically rearrange spaces based on most recent use? [Yes] When switching to an application, switch to a Space with open windows for the application. [No] Group windows by application. [Yes] Displays have separate Spaces.
Does anyone else have the same issue? If so is there a fix?
-
Admin about 7 yearsEvery time I connect my external monitors, its a crapshoot. As often as not, the displays are flipflopped.
-
Admin about 7 years
-
Admin about 7 years@geva This is not the same issue as desktops getting rearranged by recent usage.
-
Admin almost 5 yearsSame problem today, with a MacBook Pro (15-inch, 2019). Two monitors, HDMI with adapter for USB-C. It happens at every plug/unplug if they are separated by minutes. @Josh answer applied, time will tell...
-
Admin almost 5 yearsWell it's been 3 days and the problem is still there. Thus I must say the problem is also present after I lock the screen and unlock it minutes later... This means no physical plug/unplug operations, yet I'm in trouble :(
-
Admin almost 5 yearsProblem solved. It was due to one of my screens that had a VGA connexion to another computer. I unplugged it to let the screen be connected only to my macbook through HDMI and the issue's gone. I assume it is due to the screen itself and the time it responds to the macbook pro may vary from times to times as it also checked the VGA connexion meanwhile.
-
-
ognockocaten almost 7 yearsScreenshots here: apple.stackexchange.com/a/296905/206646
-
davestewart almost 7 yearsJust had this happen to me again (hasn't happened for a while so I forgot the solution) and this post came back up. Thank you... again!
-
Josh almost 7 yearsThat's great. I had to re read my own post too recently!
-
ForeverWintr almost 6 yearsThis doesn't work for me. :(
-
Josh Cole over 5 yearsJust tried this, hopefully it will work as this happens to me every time my Mac sleeps!
-
race_carr over 5 yearswe use CalDigit TB3 docks and have this issue, intermittently
-
Duck about 5 yearsThis doesn't work for me. :(
-
ForeverWintr about 5 yearsDoesn't work for me either. :(
-
red almost 5 yearsThis changes the ordering of the desktops, though. If I use hotkeys to move an app from one monitor to another, they're now out of order.
-
Vidak almost 5 yearsThis is also just a temporary solution that needs to be done every time this problem happens. This also happens for me when the laptop wakes up from sleep mode (with all the screens still plugged in)
-
Micah Stubbs almost 5 yearsthis worked like a charm for me. upvoted!
-
Dan almost 5 yearsI'm using HDMI cables plugged directly into the laptop via USB-C converters.
-
Gary Reckard almost 5 yearsThanks for this!
-
Peter Cardona almost 5 yearsRe: two identical monitors: FWIW, I use the laptop display (MBP 15") and 2 different external monitors -- one LG, one Samsung, both connected via CalDigit TS3+. I regularly see the desktops associated with the laptop display and the LG switch. (Planning to try displayplacer, thanks.)
-
Karsten S. almost 5 yearsSomehow this still doesn't solve the issue that the monitor in front of me is suddenly not "LG HDR 4K (1)" anymore but "LG HDR 4K (2)" and vice versa for the monitor to the right. Thus selecting "Display 2" or "Display 3" in apps chooses a different screen. Is there a way to also change this?
-
Will over 4 yearsI am using this with Better Touch Tool on the new Macbooks. I can customize the top touch bar, and have now added a 1 button click to automatically adjust the monitors. Great solution, thank you.
-
aveneyer over 4 years@KarstenS. You may want to check the Displayplacer information for your issue. Displayplacer shouldn't be giving you the name of your monitors, but instead should be giving you a screen id ("id"). Those IDs should not change, but Displayplacer documentation does give caution about a situation where it could.
Persistent screen ids always stay the same. Contextual screen ids change when switching GPUs or when switching ports. It's recommended to use persistent screen ids. In some rare cases, you may need to use contextual screen ids since the modes list changes when macOS switches GPUs.
-
ForeverWintr over 4 yearsPlacing the top bar on my laptop (so that my laptop display is the primary display) is now working for me. If others have success with this method, please comment which screen you set to primary!
-
Karsten S. over 4 years@aveneyer I tried displayplacer but it didn't help. The problem is rather that the actual spaces are moved to different monitors after wakeup but the monitors and monitor setup stays the same. Thus
displayplacer list
gives me identical values even though all windows are wrong. It completely switches the spaces you may have set up and suddenly my monitor to the right has 2 spaces and the center only one. Should be the other way round. -
nolazybits over 4 yearsThat was it!!! Thank you so much for finding this. I was driving me nuts!!
-
Joshua Fermin over 4 years@Dan thanks a lot this solved it for me! I'm using two HDMI cables as well! this drove me nuts!
-
Hassen Ch. over 4 yearsThis doesn’t work. I have a MacBook Pro 16 and I never change the ports and they keep switching places
-
bheussler about 4 yearsI made an Alfred workflow that runs this command. Thank you!
-
임정묵 about 4 yearsThis does not seem like good advice from Apple Support. The Caches folder contains a lot of things that are nothing to do with your displays. I would personally not recommend you try this approach.
-
Joshua Kemmerer almost 4 yearsThis worked for me as well, but not the first time. First time I went in clockwise order for my three screens, and it didn't work, but I went in counter-clockwise order and it switched them.
-
Gonz over 3 yearsWorks for me, fixed after years of pain.
-
aveneyer about 2 yearsToday is my first day back in the office after two+ years. I haven't needed my own script in the home office, but the first time I reconnected my system at work this issue happened. Hit my hotkey and fixed!
-
Admin about 2 yearsIf anyone else gets the "command not found" error when setting up the service, this fixed it for me: github.com/jakehilborn/displayplacer/issues/13