Black or displaced screen when screen sharing headless mac mini on macOS 10.12 My config: Mid 2012 Mac mini connected to a projector via HDMI. The projector is typically off and the Mac mostly works headless. 

This setup has worked for me for a couple of years now. Ever since I upgraded to Sierra (10.12.3), I get only a black screen with the mouse pointer being visible though. When I log out (cmd+shift+q), I sometimes get an image but it does not really update and is displaced.



Once I turn the projector on, screen sharing will also start working – even if I turn the projector off again. SSH always works without issues.

Any clues how I can fix that? 

What I tried (will update):


SMC reset
NVRAM reset
killing the Screen sharing service
Running "First aid" in disk utility (also from the Rescue partition)
Run maintenance scripts in Onyx


Update 1: This seems to be a related Apple Discussions thread.

Update 2: I added an answer that gives some hints. Can anyone help me find a better solution, please? My guess is the GPU has to be force enabled somehow, e.g. in bash...
These are solutions that I found but that do not work for me:


UPDATE: The issue finally and miraculously disappeared after  updating to macOS 10.12.4.
If you run third party applications, such as AirParrot or f.lux, you should try completely uninstalling those, as discussed here. 
If your mac is 100% headless (i.e. no screen attached), you can either add an HDMI dongle or hack your own Thunderbolt dongle using a VGA adapter. This is a common trick to activate the GPU and comes with the added benefit that Screen Sharing gets much faster. This actually works for me, but is not a permanent solution to my problem.