Archives / Search ›

A pax on the OS X Installer

One of the worst parts of Mac OS X is its installer. “Primitive” is being generous, especially when coming from the Mac OS 9 installer, which was wonderfully elegant in operation, if a bit confusing in both authoring and licensing from a developer standpoint. It’s been three major releases and there’s still no “uninstall” or “remove” option—both the former NeXT and Apple installers had one, so they really had no excuse. Worse, the package format isn’t designed for supporting package removal, so even if some hypothetical future installer were to support it, all the existing packages couldn’t be touched. We are left with rooting around on our filesystems ourselves, or using incomplete third-party solutions like DesInstaller. The installer is getting some major revisions for Tiger, from what I hear, so I hope the uninstallation problem is solved.

At the root of the installer problems is the use of pax as an archiving utility. Given that most installations do a lot more than just unpack some files in the filesystem, it is responsible for clobbering symlinks, corrupting permissions, disrespecting users’ moving and renaming of applications, and lots more. Everyone else in the Unix world uses tar instead of pax, but for some odd reason Apple had to be different. The pax tool is a pain to use, but I’ve discovered some convenient workarounds, to follow.

Sometimes I want to see what’s inside an installer package, or extract the files from it without running the installer proper. On Mac OS 9, Apple provided the convenient TomeViewer utility; OS X’s equivalent is lsbom and pax, or the $20 shareware Pacifist. But Pacifist isn’t much help if you’re just ssh’d into a machine, or if I’m on a computer without Pacifist installed. While trying to figure out pax’s obtuse syntax for the 3000th time last week, I noticed something interesting:

% gunzip Archive.pax.gz
% file Archive.pax
Archive.pax: ASCII cpio archive (pre-SVR4 or odc)

Hmm, cpio. I wonder…

% ditto -x Archive.pax.gz Archive
% ls -l Archive
total 0
drwxrwxr-x    4 nicholas admin         136 Nov  2 18:53 Library/
drwxr-xr-x    3 nicholas wheel         102 Nov  2 18:53 private/
drwxr-xr-x    4 nicholas wheel         136 Nov  2 18:54 usr/

Make sure to use sudo if you want ditto to preserve the installer creator’s intended permissions.

A lesser-known feature of Panther’s ditto is that it can produce and unpack cpio and ZIP-format archives. In the case of ZIP, it can even include the Mac metadata in the format the Finder (really BOMArchiveHelper)’s “Create Archive” command uses, with the --sequesterRsrc option. There’s lots of useful information about using ditto for archiving in this Mac OS X Hints article.

ditto has the -z option to indicate that the cpio archive is compressed, but it seems optional (as above); you can just use -x. ditto’s option parsing is brain dead anyway; despite its use of GNU-style long options it won’t take -zx; it wants -z -x.

From the Finder, you can pick “Show Package Contents” from the package’s contextual menu, navigate into the Contents folder, and invoke BOMArchiveHelper to extract the archive; just rename the .pax.gz file to .cpgz, acknowledge the stupid alert if necessary, and double-click. You can also rename .pax to .cpio if you uncompressed it first.

So, there you have it: two considerably more convenient ways to extract .pax.gz files. You still need to use pax or Pacifist (or cpio, I guess) if you’re dealing with a huge package and don’t want to extract every file in it.

By the way, if you’re still writing installers using Apple’s pitiful PackageMaker, go get Iceberg. It’s free, and terrific—what PackageMaker should have been.

Starting the OS X screen saver

A friend of mine, and recent first-time Mac purchaser, asked whether there was a way to trigger the screen saver from the keyboard, perhaps from LaunchBar. Of course there are the hot corners, and the lesser-known menu extra (part of Keychain Access), but for whatever reason, they didn’t work for him.

If you don’t have OS X set to lock the screen when the screen saver activates, then just start ScreenSaverEngine, conveniently located in /System/Library/Frameworks/ScreenSaver.framework/Resources. Don’t do this if you have screen locking turned on in Security System Preferences; your Mac will hang on exit from the screen saver and won’t let you do anything until you reboot or log in remotely and kill loginwindow.

So, I set out to produce a tiny app that just starts the screen saver, in the same way the menu extra does, free of the above unfortunate side effect. Download StartScreenSaver here. Thanks as usual go to Can Combine Icons for the cheesy knock-off icon that took 2 minutes to make, because I have no artistic talent whatsoever.

And yeah, I know I promised I’d write some more; been real busy cleaning, doing errands, and spending too much money (plane tickets to Australia, new digital camera to document trip, non-exorbitantly-priced spare battery for camera, CompactFlash card for camera, annoying StuffIt Deluxe upgrade which doesn’t let you “custom install” and crashes installer when you try to uninstall the Archive-via-Rename functionality by itself…)

You know it’s time to go to sleep…

…when you try to throw your dirty clothes in the trash instead of the hamper. Something along the lines of putting the milk back in the cupboard instead of the fridge (which, unfortunately, I’ve done too.) It’s time again for a wide-ranging update on what I’ve been up to.

Research is not letting up. After ISCA madness concludes next week, we’re getting a real file server instead of using my advisor’s workstation for the task, perhaps resulting in the disappearance of the random NFS problems we’ve been seeing! Workstation upgrades are also in the pipe, not that the 2.4 GHz P4 on my desk is all that slow. It sure beats the memory- and disk-starved ~250 MHz SGI O2s and Sun Ultra 30/60s we had at my previous lab. I use my PowerBook most of the time anyway, but since the cluster we’re supposed to use is so flaky, I’ve set up Condor on our research machines and the ACM Linux boxes, and the extra speed will be worth it. Condor works remarkably well overall, though we’ve seen some mysterious I/O slowness/corruption recently.

At work, I’m back to having a decent machine—set up a nice new 3 GHz P4 yesterday—but still have loads of stuff to finish for a presentation the MSP is giving to graduate departments next Thursday.

ACM admin stuff? Good news: we’re getting a bunch of old-but-decent 2U Intel servers donated next week, so we can stop using workstations as servers (e.g. clortho, wilbur, afs2, afs3). Bad news: the soda machine died and the Assabet board we want to use as a replacement for the surplus PC is resisting all our attempts to put modern Linux kernels on it. Other: we’re working on getting the videos from the conference talks posted to the Web; they were recorded/encoded in Windows Media format at various bitrates and definitely need some editing. Need to figure out some way to transcode into something QuickTime can read, so we can get them into Final Cut Pro.

Then there’s planning for my trip to Australia next month, and a ton of personal and family issues. I’m very excited that my parents are driving over from Boston for Thanksgiving, since it doesn’t seem like I’ll be able to get away, and they might even bring a sofa with them.

The shoulder strap on my bag broke this week, beyond repair. I love the bag, but the strap hooks are just horribly designed—the clips fell off the first week, and the rest of the thing is brittle plastic which gave up the ghost after two years. My previous bag had metal hooks, which took over four years to break in the same place.

The kernel panics I get during backups of my PowerBook haven’t stopped with 10.3.6. They sure look filesystem-related…

0x1da580 <hfs_clearlock+368>:   0x7c7f1b79
0x1ef6c8 <MacToVFSError+23396>: 0x4800000c
0x20b940 <closef+180>:  0x7fe3fb78
0x2463c4 <unix_syscall+580>:    0x801e00a4

Last but not least, I bought a bike a few months ago, and it’s totally changed my week. No longer am I beholden to the bus schedules, and I get exercise and a built-in cool-off period when I’m coming back from exercising. Yet another of those “why didn’t I do it five years ago?” things.

And now it really is time for sleep… I’ll try to post the aforementioned hiptop2 review, and some neat hacks I’ve written recently, next time. *yawn*