Make Your Own Free KVM Box

Now everyone doesn't have an extra computer lying around but for those who do, here's how to not spend money buying a KVM box and making your own software-based KVM solution. Now, what's a KVM Box? A KVM Box is a device that allows you to use one set of keyboard, display (video) and mouse devices with more than one computer.

Here are the requirements for your very own software-based KVM setup:
  • Two computers with necessary video-out ports for the display.
  • A display with two inputs (one for each computer) and a convenient button somewhere on the display itself to switch between those inputs. This probably means that Apple displays, owing to their extreme paucity of buttons, are out, but Dell displays with their convenient input-source-switching buttons are in.
  • All the necessary cables to connect each computer to a port on the display.
  • A FireWire or other Fast/Gigabit Ethernet cable to hook up the two computers
  • Apple Remote Desktop or any other VNC client software such as Chicken of the VNC
Step 1 - the software side of things on your secondary computer
Your "secondary computer" is the one you'll be using through VNC or Apple Remote Desktop and so one assumes it's the one you'll be using less.

Just head over to System Preferences > Sharing, check the box next to Apple Remote Desktop. If this is the first time you're activating it, a sheet with Access Privileges opens up to greet you. Now, if you're going to use Apple Remote Desktop, then, in this sheet, option-click next to any administrative user whose password you're aware of. However, if you were planning to use good old fashioned VNC, instead of checking the box next to a user name, you check the box next to "VNC viewers may control screen with password: " and enter a password in the field. In either case, click OK when you're done. That's all you need to do for this part of the setup. Promise.

Step 1.5 - making sure both computers are on a local network
If you have a LAN, that's great. Just hook both your computers up to that LAN and you're done.

If you have a spare FireWire or Ethernet cable, just hook it up between the two computers. On your primary computer, go to System Preferences > Sharing > Internet. Choose any network connection in the "Share your connection from:" field and check the box next to Built-in FireWire in the "To computers using:" list. In case you're hooking up the two computers using an ethernet cable instead, check the Built-in Ethernet box instead. Click Start. Click Start again in the sheet that pops up.

For the record, this'll work over AirPort too and Bluetooth (though I seriously recommend against using Bluetooth to network two computers unless all you like to do is ping one from the other).

Step 2 - the software side of things on the primary computer
The procedure involved in the KVM-type switching is basically this:
  1. Connect to remote computer and make it full screen
  2. Press the input-switcher button on your display
For the software side of things, Apple Remote Desktop is probably the easiest way to go. Unfortunately, unless you can obtain "a copy from a friend", this thing will cost you upwards of $300 and that is why I am including a VNC solution as well. *cough* Demonoid *cough*

If you have Apple Remote Desktop, go ahead and open it up and click on Scanner in the Source List. Your computer should show up somewhere. Select it in the list (you can hit the Stop button to stop scanning once you've found your Mac) and click Control. Enter the user name and password for the Mac and hit return. Now, just turn the Quality setting (top-right of window) down to the lowest and hit the Full Screen button. Once you enter full screen, just move Remote Desktop's floating toolbar to the bottom of the screen and press the input-source-switching button on your display. Now you're controlling the secondary computer with the same keyboard, video and mouse - we have KVM!

If you are using a VNC client of some sort, just open it up, enter the IP address of your secondary computer, enter the password you set up on the secondary computer, make sure your session is going to be full screen and hit the appropriate connect button. Then, as with ARD, press the button on your display for input-source-switching and now you're KVM'ing.

Optional - automating the procedure a bit
Now, if you do have a copy of Apple Remote Desktop, this AppleScript will automate the first part of the process:

tell application "Remote Desktop"


end tell

tell application "System Events"

tell process "Remote Desktop"

tell table 1 of scroll area 1 of group 2 of splitter group 1 of window "Remote Desktop" to select row 3

click button "Control" of tool bar 1 of window "Remote Desktop"

delay 2

--ok so I don't know how to do loops in AppleScript; so sue me; this basically makes sure you're using the lowest quality setting for least CPU and bandwidth overhead

perform action "AXDecrement" of slider 1 of group 9 of tool bar 1 of window "Mini"

perform action "AXDecrement" of slider 1 of group 9 of tool bar 1 of window "Mini"

perform action "AXDecrement" of slider 1 of group 9 of tool bar 1 of window "Mini"

perform action "AXDecrement" of slider 1 of group 9 of tool bar 1 of window "Mini"

click button 1 of group 6 of tool bar 1 of window "Mini"

end tell

end tell

What the aforementioned AppleScript does is that it opens the Remote Desktop application, connects to your secondary Mac, sets it to the lowest quality video setting (to reduce CPU and bandwidth and because you won't be using that display to see anything) and makes it full screen. You can do this manually or write a script for it as I have done. To do UI Scripting (for not all apps support bread-and-butter AppleScripting and you could be using some run-of-the-mill VNC client), visit Apple's useful website on the matter.

Hope this was useful! Do let me know in the comments on how this can be done more smoothly while maintaining a Rs. 0 price tag. 

Comments (2) Posted on at  

  • » Why not use Synergy instead?

    This is a little tool on Mac/Win/Linux that allows you to share the keyboard and mouse of one computer with one or more other computers, including support for copy/paste between systems. It really shines when you have multiple displays because you can move the mouse pointer over the edge of the screen and you're on another computer.

    It would be cool to make it such that when you go to another system the screen is blanked so the monitor automatically switches to the other input...
  • » OK, so I actually tried out Synergy. It wasn't easy because this isn't some nice DMG-encased binary that "just works" and it definitely isn't for those of you don't like the Terminal, because there is a hell of a lot of Terminal-based configuration in Synergy. Still, I am your brave quasi-geek who will go to some extents in an attempt to simply/elegantize his workflow.

    After using Synergy for a bit my impression is that (a) the installation is a lot more involved than the procedure I have described, (b) it is not good for me because I have to set a screen edge/corner to switch computers and I just don't like that because mouse movement is erratic and my mouse suddenly switches to a different computer (not to mention the fact that my corners are all already triggered and I am left to use a screen edge or hotkey) (c) mouse movement on the secondary computer is quite erratic and generally unsmooth compared to the Remote Desktop/VNC procedure and (d) installing Synergy as a permanent feature requires a lot of mucking about with StartupItems or LoginHooks and that just scares the shit out of me.

    In all, I am not satisfied with Synergy and am going to continue to use my concocted method because it's just smoother and simpler to install (a lot of what it uses is built-in to OS X or a drag-n-drop installation) and use and is, more importantly, "on demand" and does not need to run when I don't want it to.