Tip: Remote login to recover from missing display

This morning, I found that my Mac’s screen wouldn’t wake up. The computer runs 24x7, with the screen blanking after a few hours of idle time. Nearly all of the time, I just tap a key on the keyboard to wake the screen when I want to use it.

This morning, that didn’t work. The screen remained asleep. I tried obvious things like hot-plugging the display and hot-plugging the keyboard, but no luck.

The usual thing most people do in this situation is to forcibly power-off the computer and reboot, but I never like doing that, because there are always open files. Sure, the file system’s journal should be able to recover everything, but it’s still something I reserve for a last resort.

Fortunately, I always have remote login (System Preferences → Sharing → Remote Login) enabled. So I was able to use SSH to log-in from another computer:

$ slogin username@hostname

As it turns out, the computer was up and running just fine, only without any display - as indicated by the fact that I was able to log in remotely.

From there, I was able to safely reboot it:

$ sudo reboot

This did reboot the computer (I heard the startup chime and everything), but I still had no display afterward. So I logged in (remotely) again and told it to power off:

$ sudo shutdown -h now

It powered off. After waiting a minute, I pressed the power button and it booted up normally.

I have no idea what caused the hardware to forget the display, but at least I was able to perform a safe power cycle, thanks to the use of remote login capability.

If you normally don’t keep remote login enabled, you might want to enable it, because it comes in very handy in situations like this where the computer is running normally but the attached display/keyboard/mouse are not working.


I’ve tried this in the distant past, but could never get around the fact that there would always be some app that would throw up a dialog asking me to save or close a document. Is there a way around that problem that you know of?

awesome backups, obviously.

In my case, nothing was running. When I finish up for the night, I generally quit all my apps, so only background processes are running.

I’m surprised the Unix-level shutdown command could be blocked by a graphical app. I always assumed that confirmation to be the product of the GUI layers and would not interfere with the lower-layer shutdown operation.

If there is a GUI app getting in the way, I think the solution would be to connect using screen sharing (which, of course, needs to be previously enabled), then quit apps and shutdown from there. Even if the connected display is blank, there is probably still a desktop that you can access this way.

If you can’t take care of it through screen sharing, but you have an idea what app is causing the hold-up, you can get rid of that with

kill -9 PID

with the PID you can easly grab from something like ps or top. Depending on app, you could lose data since last saved, however, that’s no different from if you had just force rebooted the system. The advantage of this is that you can be more granular so fallout should be more contained.

On some Linux systems there’s a force argument to prevent user GUI processes from getting in the way of a restart/shutdown command like you detail. I’m afraid macOS doesn’t offer that option.

Yeah, I’ve tried the screen sharing thing and the killing of specific processes, in the past, usually unsuccessfully (in part because there’s often something else wrong that’s caused the screen to black out).

In the end, I’ve just moved on to accepting the possible loss from forcing the power off. Realistically, it’s the sort of thing that happens extremely infrequently now anyway (once a year, maybe?) so I live with it.

I had the blank screen problem recently. These steps brought up the login window with no loss of data.

  • Login from another system using ssh.
  • Execute the command ps -ax.
  • Locate the PID for /System/Library/CoreServices/loginwindow.app/Contents/MacOS/loginwindow.
  • Execute the command sudo kill -9 PID, where PID is that found for loginwindow

Not only was no data lost, it took longer to type this note than to connect and cause the login window to reappear.

Actually, I think it’s possible to enable screen sharing from the command line. I looked into this some years ago when supporting some Macs remotely using Apple Remote Desktop. I can’t remember how it’s done, and don’t have time to look it up right now, but I’m 95% sure it’s possible if needed.

That simply terminates the current user session. It’s as if you force quit every app that user had launched and put him/her back at the login screen. In that sense it’s better than force rebooting the entire system, but it’s still quite invasive.

Back in the old days I remember using this.

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -activate

and there’s config options such as

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvnclegacy -vnclegacy yes

sudo /System/Library/CoreServices/RemoteManagement/ARDAgent.app/Contents/Resources/kickstart -configure -clientopts -setvncpw -vncpw abc

No idea if that stuff still works in Big Sur.

1 Like

That’s it! Yeah, I’ve not revisited kickstart in several years, so who knows if it still works.


I’d never heard of it, so I went looking. In 10.4.6 Mojave and 11.2.2 Big Sur, it’s still there. Of course, that doesn’t mean it still works as before.

1 Like

@Simon is exactly correct but omitted the possible traumatic effects on peripherals.

The closest equivalent in a fully working session is ⇧⌥Q.

If you just want to reboot without letting any apps interfere with the process

sudo shutdown -r now

will do that for you.

Or you can use

sudo shutdown -h now

which will power down instead of reboot (the -h is for halt) according to man shutdown.

1 Like

I am using Apple Remote Desktop daily for work. It is great for recovering from situations like this. Many times I am able to get in and see the Desktop while the user has a black monitor.

Ooo, I’ll have to ssh in and try this…

??? That was already discussed at the top of this thread.

Yeah, I see that now. At the time, I thought it was just a command to shut down the Mac, which wasn’t something I wanted to do, and didn’t realize the flags would eliminate the alerts from apps.

While we’re talking, if you want to get back to the login screen (basically stop all of the GUI processes and log the user out) you can use

sudo /usr/bin/killall -HUP WindowServer

That will also not give apps a chance to save, however.

This sometimes happens to me on a MacPro Desktop with external monitor. I simply unplug the monitor cord from the back of the monitor or from the GPU connector; wait 15 seconds; the plug it back in. After that I can continue working normally. This will likely work with a Mac Mini as well, but unfortunately not with Macs with a built-screen unless you have also connected and external monitor. My gut feeling, given these reports, is that it is a GPU driver issue that so far Apple either has decided not to fix, is a deferred bug, or has just plain ignored.