How to configure synergy on Mac OSX and Windows XP

At the office I use both my Macbook Pro running OSX 10.6.3 and a Windows XP box side by side, each with separate monitors.  In the beginning I would use my Mac as my primary desktop, and VNC into my XP machine to avoid using two keyboards and mice.  This configuration worked well, but was a pain to have to open VNC to control my Windows XP desktop.  Then I discovered synergy+ which allowed me to use only one keyboard and mouse, and control both screens as if they were one machine, moving the mouse freely to each one as if I had dual monitors. From the synergy+ website:

Synergy+ (synergy-plus) lets you easily share a single mouse and keyboard between multiple computers with different operating systems, without special hardware. All you need is a LAN connection. It’s intended for users with multiple computers, where each system uses its own display. It’s a little like having a 2nd or a 3rd desktop…

How to configure synergy on Mac OSX

I’m running the synergy+ server on Mac OSX 10.6.3, since that is my primary machine.

First, download synergy+ for the Mac, then download synergy+ again on the Windows machine.

Once installed on both machines, you will need to create a synergy configuration file on the server (Mac).  Here is what mine looks like:

section: screens
alt = super
super = alt
section: links
right = windows-workstation
left = macbook-pro.local

The config file is pretty straight forward. The first section, called screens, is where you list the hostnames (computer names) for screen1 and screen2, in this case, my macbook-pro is screen1, and my windows workstation is screen2.  The alt=super and super=alt lines are two tricks I found that will allow the Windows key on my keyboard to function properly.  In the next section, called links, you define the layout of the two screens. In my config, my macbook screen is on the left, and my windows machine is on the right, as you can see defined in the config above.

Save the config file as synergy.conf and place it anywhere you’d like.

Now that you have the synergy server configured, you need to start it.  Open a terminal, and run the following command:

synergys -f --config /path/to/synergy.conf

The -f option will run the synergy server in the foreground, in case you need to debug anything.

How to connect to your new Mac OSX synergy server from Windows

Now that you have the synergy server running on your mac, you need to connect to it via the synergy application in Windows.

If you didn’t do it in the earlier step, download synergy+ for Windows and install it.

Next, open Synergy+ and select “Use another computer’s shared keyboard and mouse (client)” and type in the IP or hostname of your mac and click Start.

If all steps were followed correctly, you should now be sharing the keyboard and mouse, and should be able to move your mouse to each screen as if you had a dual monitor setup.

Start synergy server when a user logs in

The last thing you’ll want to do is to make sure synergy starts every time you log in. To do this, you’ll want to create a LoginHook

First, launch a terminal window and become root:

sudo su -

Create a folder to store your LoginHook script:

mkdir -p /Library/LoginWindow

In this folder, create a file called that contains the following text:

prog=(/usr/local/bin/synergys --config /path/to/synergy.conf)

### Stop any currently running Synergy client
killall ${prog[0]##*/}

### Start the new client
exec "${prog[@]}"

Make sure the script is executable:

chmod 755

Now create the actual login hook that will call the script we just created:
defaults write LoginHook /Library/LoginWindow/

That’s it! Next time you log into your mac, the synergy server will start, and your windows machine should connect.