I use my iMac almost every day as a 27" external display with my MacBook Pro.
- While connected, the iMac won't go to sleep, which is exactly what it is expected.
- But, after disconnecting, the iMac should go to sleep. Somehow, it is prevented (in order to always be ready to connect, again?). The problem: If you do not set it to "sleep" manually, it will stay on forever! This is really annoying to find your iMac running all night...
pmset -g | grep sleep
tells you this:
hibernatefile /var/vm/sleepimage
networkoversleep 0
disksleep 10
sleep 10 (sleep prevented by sharingd, dpd, useractivityd)
displaysleep 10 (display sleep prevented by dpd)
Obviously,
sleep
anddisplay sleep
are prevented by dpd (Display Port Daemon), see also an unanswered question in Apple Communities: DisplayPort daemon (dpd) blocks sleep even when not in use.