Surprising legacy in OSX Tiger

If you got your feet wet with unix by using Linux like me, you may sometimes be surprised about behavior of simple command line tools on “real” Un*xes like BSD.

I just found out about some Unix history by using the zcat command on Mac OSX Tiger.

zcat is the really handy shortcut command to quickly expand a (gzip-) compressed file on the fly, e.g. for viewing a logfile, as in:

$ zcat /var/log/messages.0.gz | grep "Error:"

Now suddenly this didn’t work for me, the command kept saying something like “messages.0.gz.Z: file not found”. The reason appears to be that there was an ancient zcat tool, way before Linux and the GNU project were invented, which only operates on “compress” compressed files, ending in .Z
Compress was an old Unix compression format, which to my knowledge nobody is using for at least 10 years.

And for some reason, Apple reverted back to this original tool, leaving zcat as gzcat. I guess they get some unix purity karma for this, but to me it’s just confusing and some Unix history I really don’t need to know about.

So folks, just remember: use gzcat and everything will work just as always under OSX.

$ gzcat /var/log/messages.0.gz | grep "Error:"

And don’t forget to inspect your shell scripts if something just stopped working when migrating from Panther to Tiger…