Unzip Mac OS X Archives from the Command-line

I was under the impression that most, if not all, OS X command-line utilities are resource-fork aware (where they need to be anyway)

It seems that this isn’t the case.

The Unzip command does not understand the way that BOMArchiveHelper stuffs resource forks into zip files, and just unzips the __MACOSX directory alongside the other files.

OK, so resource forks are dead and buried – well, not quite.

Fonts.

In particular, PostScript Type 1 Fonts, on the Mac, still use resource forks.

If you’ve created an archive with some fonts in the Finder, and want to unzip it on the command-line, simply running unzip filename.zip won’t do what you want it to.

You’ll instead need to use ditto:

ditto -xk Archive.zip .

This then works it’s magic on the __MACOSX directory, putting the resource forks back together with their files and everything is happy once more.

This article was posted by Kai Howells. If you liked this content and have any technical work in the Melbourne area, say hello via my contact form or give me a call on 0419 361 653 - I cover most of the greater Melbourne area and my rates are competitive.

One Response to Unzip Mac OS X Archives from the Command-line

Leave a Reply

Your email address will not be published. Required fields are marked *