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?
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.
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.
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.