iMac screen doesn't turn on if no keyboard present

I have a spare 2007 iMac which I'm using to display photos in my house. The iMac is set to boot & shutdown automatically at scheduled times, and display photos from my library using the screensaver.

Everything works well except that the iMac won't turn the display on at boot time without a keyboard connected. I can force the display on by connecting remotely, after which it remains on (I had to use sudo defaults write /Library/Preferences/com.apple.RemoteManagement RestoreMachineState -bool NO to stop the display turning back off after the Remote Desktop session disconnects).

How do I force the display to come on at boot or login time (don't mind which) without needing a keyboard connected? I suspect something from pmset (e.g. pmset displaysleep 0) would do the trick but nothing so far.


Running caffeinate -u after booting should do the trick.

This simulates a user activity which wakes up the display if it is asleep.


Solution was to also remove the requirement for a password after the screensaver starts (disable screen lock).