Collaboration

Send instant messages between Macs on a LAN

You can set up the ability for Macs on a LAN to send quick instant messages to one another with the Growl notification system and use of the command line. Vincent Danen shows you how.

One handy feature when you have multiple systems is the ability to send quick instant messages from one Mac to the next. Much like older versions of Windows had a quick-and-dirty instant messaging facility via WinPopup, it is possible to make OS X do something similar.

The solution involves some command-line use, and the Growl notification system. The first thing is to install Growl if it is not already installed. Growl is a great notification system and a number of applications use it, so if you don't have Growl already installed, you're really missing out. Also, be sure to install growlnotify in the Extras/ folder of the Growl install disk image. Growlnotify is the command-line client that can be scripted to send messages to a remote Growl server.

Next, on the system that you want to receive these remote messages on (not the sending system), start System Preferences and open the "Growl" section. Enable Listen For Incoming Notifications and Allow Remote Application Registration, and be sure to set a server password. This forces a remote application (such as growlnotify) to authenticate before the receiving Growl instance displays the sent message. Messages sent will use the default display settings.

On the command-line, growlnotify can be invoked as:

$ growlnotify -H 192.168.1.12 -t "Hello" -m "This is a test message" -P sekrit

This will tell growlnotify to connect to the Growl listener on 192.168.1.12 with the password "sekrit." The title of the message is "Hello" and the -m option provides the actual message text to display. Without the password, no message will be displayed on the remote system.

Using growlnotify like this is quite useful if you feel like using the command-line. It's great for reporting on things happening on one system to another, but it doesn't really lend itself well to quick instant messages (such as with an instant message client). This can be remedied with an Automator application or workflow that looks like the following:

Click to enlarge.

This script, when run, will ask for a string of text to display as the instant message. It will then pass that text as an argument to the message option (-m) of growlnotify, with the title of "Instant message." This script can be saved as an application so it can be double-clicked or called with a launching program like LaunchBar or QuickSilver.

It can be extended, of course, to also ask for a password and IP address, rather than just the message. If you will be sending to more than one system, you may choose to extend it, or have multiple applications, one per remote system, with the hard-coded password and IP address instead. For instance, saving the application as "Message odin" might imply sending an instant message to the computer named "odin", and if the other scripts are named similarly, using LaunchBar to activate them will be easy.

Quick one-off instant messaging, in the same spirit as WinPopup, is something that was missing from OS X. Sure, you can use iChat and the Bonjour list, but you need to be running iChat all the time in order to receive the messages. A system like this takes a small amount of effort, but is always-available, regardless of whether you remembered to open iChat or not.

About

Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.

2 comments

Thanks for this article! I have been looking for how to do this via Growl for YEARS, and it has seemed insane to me that no simple GUI app existed to do exactly this. (You know, we used to use a similar function on AppleTalk with an app called Radiation -- designed to send prank system messages, but worked great as a LAN notifier.) What would it take to go this one more step and build a small app that showed a list of the local machines and allowed you to select one by name (rather than IP) to send your message to? I am not a programmer, and I would pay for that.

wdewey@cityofsalem.net
wdewey@cityofsalem.net

This looks exactly like windows messenger which is normally disabled for security reasons. Bill