How To: Control your PC and MAC (or Linux) from the same Keyboard and Mouse using Synergy

I have two monitors sitting side by side, the one of the left is connected to a Mac laptop running OS X Snow Leopard and the running on the right a desktop running Windows 7 – my keyboard and mouse are connected to the Windows 7 PC.

Although I could reach over and use the Macs keyboard/touchpad to control it or even install a KVM switch between my keyboard/mouse and the two machines, Synergy offers a fair more elegant method of control – once setup I can just drag my mouse pointer from the Windows 7 screen to the Mac screen and seamlessly use both systems, even better I can copy and paste between them!

Requirements

  • A LAN – Synergy sends mouse and keyboard input over your network, there is no security so be sure to only use on a trusted network (or consider using network cards dedicated to synergy, or secure tunnels)

  • Synergy from http://synergy-foss.org/

  • In this example, a Mac on the left and a Windows 7 PC on the right!

How to setup as per my example with a Mac on the left and keyboard/mouse connected to a Windows 7 PC on the right

  • First off open a Terminal on the Mac and promote yourself to root by running ‘sudo su’. Run ‘hostname’ and make a note of your MACs name, substitute this where your see ‘mac1’ below.

  • On the PC open a Command Prompt and run ‘hostname’, make a note of your PCs name and substitute this where you see ‘pc1’ below.

  • On the Mac make sure you can see your PC on the network by running ‘ping pc1’ – if you do not get a response run ‘ipconfig’ on the PC, note down it’s IP address. On the Mac edit /etc/hosts (for example, ‘pico /etc/hosts’) and add a line to the bottom of the file in the format ‘IPAddress pc1’. For example ‘192.168.1.1 pc1’. You should now be able to ping pc1.

  • Download and install the Windows Synergy software on your PC, launch Synergy and it’s configuration screen should appear:

    image

  • Ensure ‘Share this computer’s keyboard and mouse (client) is selected and click ‘Configure’

  • We want to configure the ‘Screen & links’ to look like this:

    image  

    To do this, click the ‘+’ in the ‘Screens’ section and add a ‘Screen Name’ of ‘mac1’, click OK. Repeat adding a ‘Screen Name’ of ‘pc1’.

    Select ‘[New Link]’ and from the 3 pull down lists in the ‘Links’ section select ‘right’, ‘mac1’, ‘pc1’. Click the ‘+’ button in the ‘Links’ section.

    Select ‘[New Link]’ and from the 3 pull down lists in the ‘Links’ section select ‘left’, ‘pc1’, ‘mac1’

    Select ‘OK’.

  • Click ‘Start’. Synergy will minimise to the system tray and run in the background, you can hover over its system tray icon to determine if the Mac (or other clients) have connected.

  • On the Mac download Synergy and copy the files ‘synergyc’ and ‘synergys’ to ‘/usr/bin’.

  • Create the file ‘/etc/synergy.conf’ for example ‘pico /etc/synergy.conf’ with the following content:

    1. section: screens
    2.         pc1:
    3.         mac1:
    4. end
    5. section: links
    6.         pc1:
    7.                 left = mac1
    8.         mac1:
    9.                 right = pc1
    10. end

  • Run the Synergy client by typing ‘synergyc pc1’

  • You should now be able to drag your mouse pointer from the Windows 7 screen to the Mac screen!

Trouble Shooting

  • You can close Synergy on the Mac by running ‘killall synergyc’. You can run synergyc in the foreground to view debugging information by running ‘synergyc –f pc1’.

  • Check the firewall on the PC is allow connections to port 24800.

  • Your Mac’s hostname will probably end with ‘.local’, for example ‘mac1.local’ – you should use this full name for the configuration.

This entry was posted in Security & Tooling and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *