An script of any form to manipulate multiple displays?

I have a set up with two displays (home and work). Frequently when the mac restarts only one display is active. The second display gets no signal. (The “Detect Displays” command doesn’t help).

If I launch in safe-mode both are active, but when I relaunch, it’s often just one display.

Sometimes resetting the pram works sometimes it doesn’t. Sometimes that makes the second monitor the only one active.

So what I’m wondering is if there is any ASObjC or Shell scripts that could force the mac to go into second display mode?

I don’t think so. I had similar problems with my iMac and one of the previous versions of the OS, and became very adept at pulling the plug from one socket and plugging it into another, to force things. But I suspect you’re on a MacBook and don’t have the extra socket.

That it works in Safe Mode is a possible flag for some 3rd party interference; removing any 3rd party kexts or login items is always a good test.

But trouble with displays can often be traced to the cabling and connectors. Use Apple-made cables and adapters where possible (I can attest 1st hand to that resolving one long-running resolution problem I had), and invest in new ones if they’ve been through a lot of plugging/unplugging.

kexts?

I would think that working in safe mode or on occasion most of the time would rule out cabling. FWIW, the cable I’m using are brand new that came with the Dell monitors.

Also, I’m using a mac mini that has two ports.

3rd party Kernel Extensions. They’re not loaded when in Safe mode.

Thinking in the same way, I suffered an intermittent resolution problem for 2 years until I changed the cables.

YMMV, of course, just offering suggestions based on my experience.

Might it be possible with CGDisplaySetDisplayMode, depending on whether or not the display—though lacking signal—still appears in the list returned by CGGetOnlineDisplayList.

I only have the one display, so I’m limited in what I can play around with, but obtaining a list of displays, display modes and their properties, etc. (using JXA) seems fairly straightforward.

ObjC.import('CoreGraphics');
nil=$();

var onlineDisplays = Ref();
var displayCount = Ref();

$.CGGetOnlineDisplayList(2,onlineDisplays,displayCount);

displayCount[0];

For me, obviously, the result is 1. I’m guessing the hope would be that the result for you would be 2, implying the display mode might be settable.

Thanks. For the moment the second display on both systems has magically reappeared. In both cases the system was using one display, then went to sleep and woke with both displays.

I’ll toy with these scripts when either one reverts to single display