183

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?

6
  • 23
    Every time I connect my external monitors, its a crapshoot. As often as not, the displays are flipflopped. May 8, 2017 at 14:17
  • 4
  • 6
    @geva This is not the same issue as desktops getting rearranged by recent usage. Jun 12, 2017 at 18:04
  • 1
    Same 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... Aug 9, 2019 at 12:18
  • 2
    Well 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 :( Aug 13, 2019 at 13:18

9 Answers 9

94

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.

9
  • 3
    Somehow 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?
    – Karsten S.
    Oct 1, 2019 at 17:38
  • 2
    I 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.
    – Will
    Oct 17, 2019 at 22:02
  • 13
    @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.
    – Karsten S.
    Nov 6, 2019 at 8:57
  • 1
    I made an Alfred workflow that runs this command. Thank you!
    – bheussler
    Jun 16, 2020 at 18:35
  • 1
    If anyone else gets the "command not found" error when setting up the service, this fixed it for me: github.com/jakehilborn/displayplacer/issues/13
    – Vincent
    May 18, 2022 at 13:29
66

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.

How to move the top bar between Mac windows

Alternatively, you can also drag one of the Mac windows around and then let it drop back into place.

How to shortly move the Mac windows arrangement

9
  • 4
    Screenshots here: apple.stackexchange.com/a/296905/206646 Aug 30, 2017 at 19:24
  • 2
    That's great. I had to re read my own post too recently!
    – Josh
    Sep 17, 2017 at 14:56
  • 6
    This doesn't work for me. :( Aug 9, 2018 at 5:54
  • 1
    This 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.
    – red
    Jul 18, 2019 at 14:23
  • 8
    This 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)
    – Vidak
    Jul 22, 2019 at 12:24
23

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.

2
  • 4
    we use CalDigit TB3 docks and have this issue, intermittently
    – race_carr
    Mar 8, 2019 at 17:42
  • 1
    I'm using HDMI cables plugged directly into the laptop via USB-C converters.
    – Dan
    Aug 29, 2019 at 19:14
5

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

  1. Edit your .bash_profile using your editor
  2. Insert export PATH="$PATH:/usr/local/bin"
  3. Save file and restart Terminal or Keyboard Maestro

Option 2: Use absolute path reference

  1. Add /usr/local/bin/displayplacer [enter_display_code] to your Keyboard Maestro shortcut, e.g. view Keyboard Maestro screenshot
4

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.

5
  • Just tried this, hopefully it will work as this happens to me every time my Mac sleeps!
    – Josh Cole
    Oct 31, 2018 at 10:57
  • 3
    This doesn't work for me. :(
    – Duck
    May 29, 2019 at 8:56
  • Doesn't work for me either. :( Jun 15, 2019 at 19:03
  • 4
    This 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. Jun 20, 2020 at 13:11
  • sudo purge should clear your cache ;) instead of navigating round
    – DevJ3rry
    Jul 25, 2022 at 19:39
4

What seems to work for me so far, after one week of trying, is simply connect each monitor to an USB-C port on a different side of the laptop.

1
  • 2
    This doesn’t work. I have a MacBook Pro 16 and I never change the ports and they keep switching places
    – Hassen Ch.
    Mar 6, 2020 at 11:07
1

I've got a display-setup with two identical displays connected via two separate HDMI-Adapters in two separate USB-C ports. My Macbook Pro is always connected to the displays and whenever it wakes up from sleep-mode, the displays-arrangement is mixed up. My solution until this day was to rearrange the displays via "System Preferences". Now I'm using aveneyer's displayplacer-solution in combination with a shortcut setup to launch a shell-script in Keyboard Maestro and it works like a charm on Mojave!

1

It is based on which application you are using when you plug in; it will try to keep current application on your Macbook.

0

I wrote about this problem in my Weird monitor bugs article. It happens because the monitors have non-unique UUIDs so macOS can't figure out which is which and swaps them around.

Recently I added two useful Apple Shortcuts in my Lunar app to help fix this (available without a Pro license):

Because one byte of the UUID is computed from the port used (e.g. 03 for HDMI, 04 for DisplayPort, 05 for USB-C etc.) then having the monitors connected to different types of ports can also fix this problem.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .