iMac Target Display Mode black screen

Solution 1:

On the Macbook, change the rotation on the iMac display to 90°, then revert it back (or let it revert back after the timeout) to Standard. That seems to snap it out of its zero-brightness funk more or less every time much more frequently than other display changes.[1]

(Of course, you can't do this in clamshell mode, you need some functioning display to use System Preferences→Displays on.)

[1]: (I've seen it fail once or twice, but it is the most reliable workaround I've found yet.)

Update 2021-07-12: Apple discontinued support for Target Display Mode in all operating systems since High Sierra, and so it was likely that this was officially unsupported / broken even at the time the question was written. I also definitely used TDM on Mojave for a while, and I think maybe even on a Catalina beta for a while; it still almost worked but it was incredibly janky. So if you've upgraded your iMac … some of this fiddling might help you, but it probably just won't work.

Solution 2:

On closer inspection, it looks like the display is not actually uniformly black. This led me to conclude that perhaps the backlight was just not turned on properly, and led me to discover the following workaround:

  1. Log into the iMac
  2. Change the brightness to a different level (e.g. up or down by one). The level seems to need to be different from the one previously used.
  3. Enable Target Display Mode again, by pressing Command+F2