Here’s my ideal setup:
- Use the same computer in all situations so that I only have to manage one configuration
- Use a large display for improved productivity
- My family has an all-in-one computer that’s easy to use
- As few devices and wires as possible
Here’s my computer situation:
- I use a 13″ MacBook Pro as my work laptop
- I have an Apple Thunderbolt Display at work
- I have an iMac at home
- At both work and home I have an Apple Wireless Keyboard and a Magic Trackpad
Until recently, I used the work laptop at work using the Thunderbolt Display and at home I used the iMac. This meant that I had to maintain two configurations and try to keep them in sync as much as possible, which as anyone with any experience knows, ends up being a constant annoyance. Recently I spent some time coming up with an approach that allows me to achieve my ideal setup given the above set of devices. Here’s how it works.
The Work Setup
The work setup is pretty easy. Since I don’t have to share my computer with my family at work, I just connect the Thunderbolt Display to the MacBook Pro using using the monitor’s Thunderbolt Cable and use Bluetooth to connect the keyboard/trackpad to the MacBook Pro and I’m done.
The Home Setup
The home setup is trickier, because I want to use my laptop for the purposes of “same computer always”, and I want to use the iMac’s big display, but when I’m not using the iMac, I want my family to be able to use it as a normal computer. The iMac has a feature called Target Display Mode, which lets you use the iMac as a display for your laptop, but there’s a problem – I can’t easily connect the keyboard / trackpad to the MacBook Pro because they’re already connected to the iMac. And you can’t just disconnect them from your iMac because you need to trigger Target Display Mode from the keyboard. And once you trigger Target Display Mode, you can no longer use the iMac GUI to turn off Bluetooth!
My solution, which I derived from this article, is to configure the laptop to be able to remotely turn the iMac’s Bluetooth on and off. Once you can do this, it’s straightforward – though a bit hacky – to use the Bluetooth keyboard / trackpad with the iMac -OR- the MacBook Pro, depending on what you’re trying to do. Here’s how it works:
One-time Setup Activities
- Install blueutil on both computers. Blueutil is a simple utility that allows you to turn Bluetooth on and off from the Mac’s Terminal.
- Configure the iMac to allow incoming SSH connections. System Preferences -> Sharing -> Check “Remote Login”.
- (Optional) Configure your home networking to give the iMac a static IP address.
- (Optional) Edit your MacBook Pro’s /etc/hosts file to alias the iMac’s static IP address with a shortname like ‘iMac’.
- (Optional) Add your MacBook Pro’s public key file to your iMac’s $HOME/.ssh/authorized_keys file so you can run SSH commands without entering your password.
- Disable your iMac’s Bluetooth by running
ssh bill@home-imac '/usr/local/bin/blueutil off'and then pair the wireless keyboard and trackpad with your MacBook Pro.
- Go to either “Use the iMac as a Display for Your Work Laptop” or “Use the iMac in Normal Mode” depending on what you want to do next.
Use the iMac as a Display for Your Work Laptop
Each time you want to use the iMac for work, you need to turn it into a glorified display for your MacBook Pro and connect the wireless keyboard/trackpad with the MacBook Pro. These are the steps:
- Connect the Thunderbolt cable
- Enter target display mode by pressing Command+F2 on the iMac
- From the MacBook Pro, run the following commands, changing the username and hostname of course:
# Turn Bluetooth off for the iMac
ssh bill@home-imac '/usr/local/bin/blueutil off'
# Turn Bluetooth on for the MacBook Pro
- Close your MacBook Pro’s monitor
If everything went well, you should see your MacBook Pro’s desktop on your iMac’s display and you should be able to use the keyboard and trackpad as normal.
Use the iMac in Normal Mode
Each time you want to turn the iMac back into a standalone home computer, you need to give its display back and reconnect the wireless keyboard/trackpad with the iMac. These are the steps:
- Disconnect the Thunderbolt cable, which exits target display mode
- From the MacBook Pro, run the following commands:
# Turn Bluetooth off for the MacBook Pro
# Turn Bluetooth off for the iMac
ssh bill@home-imac '/usr/local/bin/blueutil on'
If everything went well, you should see your iMac’s desktop and you should see keyboard and trackpad working with the iMac.
This is obviously way more low-level work than you’d expect with an all-Apple setup, but I think Apple is unlikely to fix something like this since it’s relevant to a very small number of people and I suspect it would be expensive and complicated to come up with an elegant solution. I would love to be proven wrong on this, of course