Home Blog Cool Geekness, Volume 1: smate

NEWS

Cool Geekness, Volume 1: smate

Posted by fusionbox on Nov. 4, 2009, 5 p.m.

Mac programmers out there may not agree on everything, but we tend to follow one principle fairly unanimously: if you're doing any sort of coding, TextMate is your best friend.  With apologies to the vi/emacs/nano/etc. crowd, there is simply no way to fully express how amazing this text editor has made our development lives on OS X.

We developers here at Fusionbox spend a lot of time connected to other servers via SSH.  For me, text editing via one of the default editors (usually vi) can be frustrating; not only do I lose my favorite TextMate features (syntax checking, code completion, etc.), but I also lose valuable time when that particular editor is configured strangely (when the left arrow key spits out gobbledygook instead of actually moving the cursor left, programming can take a really long time).

What's an enterprising OS X developer to do?

Yesterday, colinta introduced me to one of the coolest, most needed tools of the century: smate.  This delightful little Perl script allows editing of files with TextMate over SSH - fantastic!

While this script is fairly easy to install, there are a few pitfalls to watch out for.  To help out, here's a step-by-step guide on how to get this thing running on *nix-based systems (Windows users, you're on your own):

  1. Copy the script to your system - I usually like to have programs I manually install reside in /usr/local/bin.  Also make sure to put the correct permissions on it.
    [aaron@localhost ~ ]$ cd /usr/local/bin
    [aaron@localhost /usr/local/bin]$ sudo wget http://www.sergeant.org/smate
    [aaron@localhost /usr/local/bin]$ sudo chmod a+x smate
  2. The program uses familiar conventions:
    [aaron@localhost ~ ]$ smate [user@]host:path/to/file
  3. If you get an error like this - "Can't locate KQueue.pm in @INC" - then you need to install the KQueue CPAN module for Perl.  Fortunately, this is a very easy process.
    [aaron@localhost ~ ]$ sudo perl -MCPAN -e 'install IO:KQueue'

That should do it - happy editing!

NOTE: smate requires rsync to be running on the remote server you are connecting to.  The program will not run if rsync is not installed.