Irssi, screen, fnotify and Growl on OSX


Occasionally you’ll find me in IRC using the old school Irssi client. Its a simple and powerful IRC client that most importantly, I can launch on any unix based server and leave running in a screen session. A little something like this;

screen irssi
# Ctrl+A,D to unhook this screen
# screen -x to jump back into it (when you've only 1 screen open)

Doing this on a remote server, means I’m always connected to IRC. I can easily jump back in to previous conversations by ssh’ing to the server and switching to the screen.

What I wanted was a growl notification every time my name (nick) was mentioned in a room, or I received a private message. I stumbled on a few blog posts explaining how to do this, but came across a few gotchas on OSX, so here goes another explanation.


First, on the remote server (where irssi will run under screen), add the fnotify script to your own ~/.irssi/scripts folder. This is a handy perl script that will write any messages referencing your nick, to a local file (by default ~/.irssi/fnotify). fnotify is a good, simple example of irssi perl scripting.

Don’t forget (as I did) to load this script in irssi with the following command (or setup irssi to auto load it on startup, some instructions here)

/script load

Check this is working by having someone mention your name in a chat room (or pm you). You should see the ~/.irssi/fnotify file fill with these messages.


Next on OSX, install growl (if you haven’t already) and be sure to install the growlnotify script (make it executable and in your PATH e.g. /usr/local/bin) Test its working in your OSX terminal with something like;

growlnotify -m 'it works!'

SSH & connection script

Now if you haven’t already got one, create an SSH user with a key to login to your remote server. The key can have a pass-phrase. If you do choose to set one, for the following script to run without interruption, you’ll have to let OSX remember the pass-phrase in its key-chain.

Finally the client script, in OSX create the following script in ~/irssi_growler


(ssh -o PermitLocalCommand=no  \
  ": > .irssi/fnotify ; tail -f .irssi/fnotify " |  \
while read heading message; do                      \
  growlnotify -s -t "${heading}" -m "${message}";      \
  say "${heading} says, ${message}";                \

Replace your ssh_username and details, make it executable (644) and run it. This script does the following;

  • opens an ssh connection to your remote machine
  • runs the tail -f command to remotely tail the ~/.irssi/fnotify command
  • the output of which is piped to a read while loop
  • in this loop each message is sent to growlnotify, and (for an audio bonus) to the say command too :)
  • the growl message is set to be sticky (-s) and will stay onscreen until you click to hide it

Launch at startup

After numerous attempts (on Snow Leopard) trying to get this script automatically launching at startup (using launchctl, .plist’s, automator etc. etc.) I opted to just add the script to my login items. This does leave a Terminal window open every-time I login, but I can live with that for now. If someone can explain how properly add a bash script to launch on startup (as a daemon) on the latest Snow Leopard, please let me know.

The final caveat I hit was my firewall. It was smart enough to close any open SSH session after a period of inactivity. This kept killing the irssi_growler script. To prevent this I changed my ssh client config (in /etc/ssh_config) with the following ‘keep alive’ settings;

ServerAliveInterval 150 # can be adjusted higher or lower
ServerAliveCountMax 3

In the future I might re-write fnotify to do more that just write to file. It could potentially send the message data via tcp/ip to the a growl client (set to accept incoming connections).

8 comments so far

  • photo of Benjamin Schweizer Benjamin Schweizer Sep 18, 2010

    Nice to see others are facing the same problems;) Another approach would be using Jabber as an transport, you could avoid the ssh tunnel and reuse the code outside the mac world.

  • photo of Richard Gould Richard Gould Sep 23, 2010

    Thanks for this! The say command tucked in there was a horrible surprise, I must say :)

    If you find a better way to run it on startup, post an update. I’m just running it before I attach to screen for now.

  • photo of @mlv @mlv Oct 21, 2010

    Why not, on the irssi_growler machine, in your startup, do:

    screen -d -m ~/irssi_growler

    That will spawn a screen session running irssi_growler that will immediately detatch.

    It’ll run in a screen that you can attach to if you need to, but will otherwise keep running in the background.

  • photo of Jonathan Jonathan Mar 09, 2011

    Thanks for this! It was great. It did not fit my scenario exactly though. I have a laptop so I run irssi locally. I modified things just a bit to make them work for my scenario. Thought I would share.

    I installed growlnotify (great little tool), I added to my scripts and then I just edited with something similar to what you had in your shell script. Something like this:

    sub hilight { my ($dest, $text, $stripped) = @_; if ($dest→{level} & MSGLEVEL_HILIGHT) { filewrite($dest→{target}. " " .$stripped ); system(“growlnotify -s -t ‘irssi’ -m ‘You were mentioned! What an honor!’”); system(“say ‘Someone in I R C mentioned you.’”); } }

    No need for ssh stuff or adding a shell script to startup. I just run irssi and when I get a mention, growl talks to me. Beauty!

  • photo of Matt Matt Aug 24, 2011

    This was really helpful. Thanks.

  • photo of k7n4n5t3w4rt k7n4n5t3w4rt Nov 01, 2011

    Thanks, this made my day.

    However the channels I chat in use a lot of targeted posting by default so as to reduce confusion. I was getting bombarded with persistent Growl notifications and overwhelmed by the computery voice going on for ever.

    I took out the line in the script which handles the voice and the -s command which makes the notifications persist until clicked:


    (ssh dev -o PermitLocalCommand=no \ ": > .irssi/fnotify ; tail -f .irssi/fnotify " | \ while read heading message; do \ growlnotify -t “${heading}” -m “${message}”; \ done)&

    Thanks again for the good job putting this together and posting it.

  • photo of Schminitz Schminitz Mar 29, 2012

    Thanks! That was really helpful. But my growlnotifier is not working with my Lion (and dont want to buy newer version of growl).

    So I used <a href="">net-growl</a>.

    Combo ssh irssi fnotify growl net-growl perfectly works with me.

  • photo of Guyzmo Guyzmo Jan 11, 2013


    it looks like an old post, but I while I was googling I went over it. I actually wrote a while back ago a script that handles nicely the IRSSI notification over SSH:

    and by the way, I tell how to launch the local service for each SSH session, and not for the whole user session ;-)


    — Guyzmo

Leave a comment