Matt Rajca

Enabling VNC on a Mac with a Broken Display

December 20, 2011

Around two weeks ago, my iMac’s display started turning itself off at random times. I thought this was a software bug as I was running the latest developer preview of OS X, so I ignored the issue; doing a quick restart always restored everything to normal. A few days later, the display wouldn’t turn on at all. The Mac would still run and I could hear Alex speak the time every half hour. I ended up ordering one of the latest quad-core, 27” iMacs, but I still wanted to get some work done before it arrived.

If I could enable screen sharing, I would be able to work from my Ubuntu box via VNC. So I hit ⌘-Space bar to bring up the Spotlight search box on the iMac. I typed Terminal and hit ‘Return’, all while staring at a pitch-black screen. To check on the state of things, I would periodically pipe the output of commands to the say command, which would in turn speak the input. For example,

pwd | say

would speak the path of the current working directory. Next, I enabled ARDAgent to start the screen sharing agent (normally enabled in System Preferences):

cd /System/Library/CoreServices/RemoteManagement
sudo ./ARDAgent.app/Contents/Resources/kickstart \
-activate -configure -access -on -clientopts -setvnclegacy -vnclegacy yes \
-clientopts -setvncpw -vncpw PASSWORD -restart -agent -privs -all

After a quick reboot, I was able to start a VNC connection from Ubuntu 10.10 to Snow Leopard. Of course, if you have another Intel Mac and a spare FireWire cable in the house, you can always boot up the defective Mac using Target Disk Mode.

In the end, I was able to crank out a few more Xcode builds of my projects until the new iMac arrived.