Archive forSeptember, 2004

Executing OS X Commands on Login

This is a general tutorial on how to execute line commands on OS X startup, but the currently relevant example is Synergy.

Having recently discovered Synergy, I received a few questions on how to get the latest copy of Synergy (1.1.8) to start when logging into OS X. Since Synergy does not currently have an OS X gui, you need to use shell scripts. I don’t know if this is the “best” way to code an OS X shell script, but I promise it’s easy and it works. If you know of something better, I’m all ears.

Determine the Command You Want to Run

In this case, we want to start the Synergy server. I keep my Synergy folder in /Applications so the full command I would like to run is

/Applications/synergy-1.1.8/synergys

It doesn’t matter if the command you want to use is, just test it out in the Terminal to make sure it does indeed do what you want.

Create the Script

Open up a text editor and make sure it saves what you write as plain old text. TextEdit should work fine. Your file should only have two lines in it.

#!/bin/sh
/Applications/synergy-1.1.8/synergys

Now save it as “localServerStart.sh” or something that makes sense to you. I prefer to use the .sh extension simply because it helps me remember I’m using sh as opposed to some other *sh. In the end, it doesn’t matter what you name the script.

Make the Script Executable

Open Terminal and navigate to where you saved the script. Substitute “<yourfile>” for the name of your script. I would type localServerStart.sh instead of “<yourfile>“. Type the following command and press enter.

chmod u+x <yourfile>

Associate Script to Terminal

Locate the script in Finder and choose “Open With” from the contextual menu. Check the “Always Open With” checkbox, and select Terminal as your application. Click “Open”. If the script doesn’t run properly after doing this, go back and make sure you didn’t miss a step.

Add Script to Startup Items

Finally, open your System Preferences and go to Accounts. Highlight the account you’d like Synergy to startup under and click the Startup Items tab. Click the plus sign directly under Startup Items and add the script to the list.

That’s it. :)

Comments (1)

Synergy2: Laptop + Desktop Heaven

Egads, I found a way to hook up a mouse and keyboard to my laptop without wires for FREE! If that weren’t enough, I can seamlessly move my mouse between my desktop and my laptop screens as if they were using a switcher, but I don’t even have to press a button to trigger the switch! Huge thanks to Matt Mullenweg for the link to Synergy2, a networked mouse & keyboard sharing program.

I have sucessfully configured the same keyboard and mouse to be used between my Windows desktop box, and my Powerbook. Setup took about 10 minutes, longer than I had hoped, only because the OS X version is a bit immature and requires some editing of a text file. The GUI in windows makes things plenty easy, and I can’t wait to see something similar for OS X soon.

If you’re reading this, you meet the requirements to run Synergy2 unless you’re a Unix user without X11, and in that case, I’m sure you could give a rat’s ass. Here’s a little demo for all interested parties…

Synergy2 Demo Thumbnail
(synergy2demo.mov, 3.3MB, 10seconds)

Clipboard Sharing
Synergy2 Clipboard Demo Thumbnail
(synergy2demo2.mov, 4.5MB, 11seconds)

Comments (6)

Belated Congratulations

A belated congratulations are in order to Shawn and Bev for their new marriage. It was great to be there, and especially to have the honor of helping your big day go smoothly. Hopefully, you didn’t hear anyone complain about their seating arrangements.

Those of you who’re interested can check out some pre-ceremony and reception photos.

Comments