19

I have a Mac which I connect to using Screen Sharing to log in and start a video playing. Since upgrading to El Capitan, when I quit the screen sharing client, the screen on the remote machine turns off. How do I stop this from happening, while still having the screen turn off normally after a few minutes of inactivity?

5 Answers 5

33

Run this command in the terminal to fix the external screen going blank on VNC disconnect. Works with Sierra OS.

sudo defaults write /Library/Preferences/com.apple.RemoteManagement RestoreMachineState -bool NO

More context from jabenninghoff on GitHub:

In newer versions of macOS, screen sharing will automatically re-lock the screen when you disconnect if it was locked when you first connected.

6
  • tested and works on el cap (v 10.11.6)
    – B Rad C
    Sep 13, 2017 at 18:20
  • 1
    Also works on High Sierra (tested on 10.13.1). Thanks.
    – blvz
    Dec 8, 2017 at 13:04
  • 1
    Still works on High Sierra as of July 2018. Thank you! Perfect for headless or home theater Mac.
    – Matt.
    Jul 24, 2018 at 0:32
  • 2
    Still works on Catalina (beta 8). Thanks!!!
    – fumoboy007
    Sep 11, 2019 at 6:05
  • OMG THANK YOU! This was driving me nuts and I couldn't figure it out. Here we are years later and presto!
    – JVC
    Mar 13, 2020 at 13:44
5

Under System Preferences > Sharing, use “Remote Management” instead of “Screen Sharing”, as shown here:

Screenshot of Sharing Preference Pane

As far as I can tell, everything else works the same but the screen no longer turns off when you disconnect a Screen Sharing connection.

edited to add: this is under 10.11.3

2
  • Sadly, even that does not seem a 100% solution. I wish there was a better way. sigh
    – TJ Luoma
    May 7, 2016 at 1:25
  • 1
    Yeah, it appeared to work, but turns out it only works sometimes. Can't figure out what the pattern is for when it works and when it doesn't.
    – DrHyde
    May 9, 2016 at 22:23
2

To be clear - the top-rated solution here alone from colo2100cent does not solve the problem if you're connecting to a MacBook with the lid closed (tested using a mid 2011 MacBook Air running Sierra - VNC disconnect required opening the lid and a physical button press to wake it up), but works fine if you're using a desktop based Mac like a Mac mini or an iMac. A display must be connected externally for this to work on a MacBook, but this is wasteful if it's being stored in a closet as a server or otherwise not being physically accessed.

What solved the problem for me was executing the command in colo2100cent's answer:

sudo defaults write /Library/Preferences/com.apple.RemoteManagement RestoreMachineState -bool NO

while also having a headless ghost display connected to the miniDP port, purchased for about 10 bucks. It tricks your MacBook into thinking there's a monitor connected at all times but does not require a monitor. Works like a charm - no more sleeping after VNC disconnect.

3
  • 1
    Like @fitzroy pointed out in the other answer, this only works if the display (either real or fake) is plugged in during boot.
    – xiay
    Jul 1, 2021 at 22:06
  • 1
    Also for anyone who is curious, I used Amphetamine to keep the Macbook from sleep. Otherwise it won't respond to VNC in the first place once lid is closed. Amphetamine could not deal with the VNC disconnection sleep though.
    – xiay
    Jul 1, 2021 at 22:07
  • This worked when I needed to unlock a machine remotely running Monterey and didn't want to re-lock after I closed the connection.
    – nvahalik
    May 8 at 23:27
0

I also have this issue (2012 Mac running El Capitan 10.11.5). I did not have this issue on my 2007 Mac Mini running 10.6.8 with a similar configuration (except using DVI instead of HDMI). When I close Mac screensharing or TouchPad on iOS, or switch iOS apps or lock the phone, the Mac Mini turns off external video.

The workaround I've found is: Hit pause / play on the Apple Remote (the physical infrared remote — not an app) after starting the video, before closing screensharing. Then you should be able to close screensharing and the screen will stay on. I've also done this with the Apple bluetooth mouse and it works as well.

You can also accomplish this by waking the Mac Mini with the remote before initiating screensharing, if you remember. Annoying though since it will often open and start playing iTunes.

The Mac just seems to need some input from a physical device (mouse or remote) after waking to prevent it putting the screen back to sleep.

Going to try the Remote Management checkbox also to see if that helps.

0

I solved this by restarting the Mac with the display (the TV) already ON.

If starting the Mac with the display off, either using Remote Management or Screen Sharing will result in the display turning off after disconnecting the VNC client.

You must log in to answer this question.

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