teleport and OS X Lion


For those of you that want to share a single keyboard and mouse between 2 or more Macs, teleport is a great option.

The tool used to work great under Snow Leopard, but something changed in Lion that causes it to fail at waking up a target machine who's display is off due to power management. I'm not sure what Apple changed with Lion but as soon as I upgraded, I started seeing this issue.

The work around at the time was to plug a keyboard into the sleeping Mac to turn the display back on and then teleport worked fine. After a bit of digging, I found a better option. Enter *pmset*.

pmset is the OS X utility that allows for configuration of power management options via the command line. The option *displaysleep* is just what we need to solve this problem.

Because pmset requires root access to run, I ended up setting the setuid bit so that it could be run remotely by a less privileged user. All that was left was a simple script using pmset and ssh to turn the display on remotely.

I'm using the following script on the machine hosting the keyboard and mouse. Make sure you have an "authorized_keys" file in the remote .ssh directory.

#!/bin/bash
ssh chimeron 'pmset displaysleep 0'
ssh chimeron 'pmset displaysleep 20'

This has the effect of turning the display on immediately and then setting the sleep time back to it's original value.

NOTE: This is a temporary hack until the author of teleport updates it so that it automagically does what we're doing manually. According to the forums on his site, he's already working on a fix.