QuickSynergy Server Troubles

Synergy allows one computer to control the keyboard and mouse of one or more other computers seamlessly, even if the computers are all running different operating systems. I am using my Mac laptop to drive my Mac and a Windows 7 laptop. When it is working it is a pretty sweet setup, but the configuration can be a little touchy.

Sometimes the Mac OS X server refuses to start. When it fails I see this message in /var/log/system.log on my Mac:

Oct  6 13:37:06 eagle [0x0-0xe4be4b].com.cordeiro.QuickSynergy[36223]: INFO: Synergy server 1.3.1 on Darwin 11.1.0 Darwin Kernel Version 11.1.0: Tue Jul 26 16:09:02 PDT 2011; root:xnu-1699.22.81~1/RELEASE_I386 i386
Oct  6 13:37:06 eagle [0x0-0xe4be4b].com.cordeiro.QuickSynergy[36223]: FATAL: unknown screen name `eagle.local'

It appears that QuickSynergy cannot resolve the name of my Mac for some reason, though I can ping it both locally and from another computer on the same subnet.

My Mac has both a wireless and a wired 1 Gbps link, by default, routes over the wired network.  When I disconnect and reconnect the wired network, the error from QuickSynergy goes away and netstat shows that Synergy is listening on the wireless network.  Since the client that connects does so through an ssh tunnel to localhost, it does not really matter.  It just seems strange that Synergy would be able to listen on the wireless network and not the wired network.

This problem requires more debugging, but for now I can make it work, so I’ll get back to what I wanted to do and figure it out later.


Automatically Start ssh-agent on Mac OS X

Mac OS X does not automatically start ssh-agent for you when it creates a new login session.  I suppose this makes sense for much of the Mac target audience that will never use ssh, but it is annoying for those of us who use it regularly.

I added the following to my .profile automatically start ssh-agent when I open my first terminal window:

if [ "x" == "x`ps -x -u ${USER} | egrep [s]sh-agent`" ] ; then
	ssh-agent | sed -e "/^echo/d" > ${HOME}/bin/agent-env
source ${HOME}/bin/agent-env

Terminal.app starts a new login shell, which calls .profile every time you create a new window.  The ‘if’ statement check so see if ssh-agent is already running, if not, it starts a new ssh-agent and writes the output to ${HOME}/bin/agent-env.

This file sets the environment variables ssh needs to find the ssh-agent.  The ‘source’ command after the if statement runs agent-env in the current process, which allows the environment variables to take effect in the current process.

You will still have to run ssh-add to add your keys, but at least you do not have to start the ssh-agent.

Installing MacPorts on Lion with Xcode 4 from the App Store

Installing MacPorts on Lion requires first installing Xcode 4.1.  Apple makes Xcode available as a download to developers who have subscribed as Mac developers for $99 per year, or for free through the Mac App store.  Unfortunately, the Xcode installer that the App Store downloads does not install the “Unix Development” or “System Tools” components required by MacPorts.

After much fiddling, I found a way to install Xcode 4.1 from the Mac App Store and get the “Unix Development” and “System Tools” components.  Here is what I did:

  1. Install Xcode 4 through the App Store
  2. Go to the /Applications folder
  3. The “Install Xcode” application is the installer that the App Store used to install Xcode (without the components you want).  Right click on “Install Xcode” and select “Show Package Contents”.
  4. Open Contents/Resources and double click on Xcode.mpkg

Double clicking the mpkg installer will give the option to install Xcode in a custom location and to customize which components are installed, including “Unix Development” and “System Tools”.

The install process took my laptop about 30 minutes to complete.  It might be possible to cancel the initial install after “Install Xcode” has been fully downloaded, then proceed to the mpkg install, but I have not tested that.