Geek Factor

One of the joys of birthdays is ripping the wrapping paper off your gifts to discover what's inside. You'll find goodies inside Mac OS X's packages, too -- keys that unlock otherwise hidden capabilities of the OS. I'll show you how to use them to view an application's Help files in a Web browser, access Classic installation files, and change an applica-tion's default icons.

The Package Deal

Mac OS X packages are simply folders disguised to look and work like single files. The most common examples are Installer packages (files with a .pkg extension) and applications (which have an invisible .app extension). When you double-click on these in the Finder, they launch as if they were plain documents or applications, rather than opening up as folders. Packages let developers hide a bunch of related files. The user doesn't have to manage, and never has the opportunity to mess with, these files.

How does the Finder decide whether an item is a package? The file extension is one way, and it's the easiest for a user to modify -- for better or for worse. Not surprisingly, your Mac views a folder with the .pkg extension as a package. The same, however, goes for applications. Though you won't see .app in the Finder, this hidden extension also indicates that your application is actually a package. To view the extension, select the application's icon and choose Get Info from the contextual menu (1-I). Check the name in the Name & Extension field.

As far as you're concerned, it's what's inside that counts. To view or edit a package's contents, control-click on the file icon and then select Show Package Contents from the contextual menu. Inside is a folder named Contents. Open it to view the package's actual contents. Once you've learned to peek inside packages, you're ready to try the following tricks. As always when tinkering with critical files, proceed with caution!

Find Classic Installation Files

The first time you launch the Classic environment after installing Mac OS X (or an OS X update), you'll likely get a message asking whether it's OK to install some files Classic needs. These include Classic Support, Extensions Manager, and QuickTime Player.

If you need to replace a damaged or missing copy of one of these files and the automated process fails to do so, you can access them directly by cracking open the package. This also lets you access files without having to launch Classic -- useful if you want to add or replace the file in a location that isn't a valid System Folder.

1. Select Go To Folder from the Finder's Go menu and type /System/Library/CoreServices. Locate the Classic Startup application package.

2. Select Show Package Contents from Classic Startup's contextual menu. Open the Contents folder and the Resources folder within it.

3. If you're using Jaguar, you'll see a folder here named UniversalForks. In Panther, the folder is invisible. If you don't have a utility like Mac4Ever.de's free InVisibles (www.mac4ever.de/invisibles/), one easy way to reveal the contents of UniversalForks is to use the Finder's Go To Folder command and enter /System/Library/CoreServices/Classic Startup/Contents/Resources/UniversalForks/.

4. Inside the UniversalForks folder are all the Mac OS 9 files installed by Mac OS X. Make copies of any files you need.

Open Help Files in a Web Browser

If you've ever used Mac OS X's Help Viewer application -- typically accessed by selecting a command from a Help menu -- you know it's slow, to say the least. And it has no Save command, so you'll have to wait it out every time you need information. Luckily, Help is saved in HTML files tucked inside an application's package. Using iTunes as an example, here's what you need to do to open these files in a Web browser:

1. Open the iTunes application package in your Applications folder and navigate to Contents: Resources: English.lproj.

2. Here you'll find a folder called iTunes Help. Open it and double-click on the file titled iTunes Help.html. The home page for iTunes Help opens in your default browser. You can't search as you could in Help Viewer, but otherwise all the information is at your fingertips. As you click on links, you're taken to the appropriate pages stored in the pgs and pgs2 folders, also inside the iTunes Help folder.

You can access many applications' Help information in basically the same way and save copies of any pages you need regularly to your desktop. But in a few cases, you'll want to select Go: Go To Folder in the Finder and type /Library/Documentation/Help. Here you'll find the Help files for Mac OS itself (MacHelp.help), as well as for AppleScript, AirPort, and the iPod. Each of these .help items is a package. Open one and navigate to the English.lproj folder within to discover its HTML Help files. (Some links here will automatically open Help Viewer.)

Change an Application's Default Icon

You probably know that you can change most files' icons by selecting Get Info for the file, clicking on the icon in the Info window, and pasting a new icon over it. To change back to the default, select the icon in the Info window and choose Edit: Cut. But what if you want to change the default icon itself? Once again, you can do this by delving into a package. In this example, I'll show how you can replace the guitar icon for GarageBand with a photo of yourself, say, playing a guitar.

1. First you need to get a photo of yourself. If you have an iSight camera, launch iChat, click on the camera icon at the top of the Buddy List window, place yourself in the camera view with guitar in hand, and select Take Snapshot from the Video menu. (If you already have a photo from another source, just use that.)

2. A file called Video Snapshot 1.tiff will appear on the desktop. Now you must convert this file into the correct format for icons. To do this, launch Terminal and type tiff2icns followed by a space. Then drag the Video Snapshot icon to the Terminal window. This should add the file's pathway to the command line. Press return. A file called Video Snapshot 1.icns will appear on the desktop. Quit Terminal.

3. Locate the GarageBand application. Select Show Package Contents from GarageBand's contextual menu, navigate to Contents: Resources, and locate a file called GarageBand App.icns. Move the original file somewhere safe in case you later want to undo the changes you make now.

4. Now rename your .icns file GarageBand App.icns and put it in the Resources folder.

5. Hold down the option key and select the Finder from the Dock. From the menu that appears, select Relaunch. When the Finder reappears, GarageBand should sport your new icon.

The icon's image quality won't be great, but you can improve it by cropping the image in an application such as Lemke Software's GraphicConverter ($35; www.lemkesoft.de) or Adobe Photoshop CS or Elements ($649 and $99, respectively; www.adobe.com) before converting it. You can also use any existing .icns file, such as one taken from another application or downloaded off the Web, instead of a photo image. Follow the same basic method to replace other application icons. For example, to change the icon for GarageBand documents, you'd replace the file called GarageBand Document.icns, located in the same Resources folder.

Wrapping Up

Maybe Mac OS X packages aren't quite as much fun as birthday presents, but when you understand their tricks, you'll get much more out of Panther.

Geek Favorites

Relive those late nights on your college VAX machine by playing text-based adventure games through iChat (or any other device that connects to AOL Instant Messenger). Thanks to programmer Andy Baio, all your old Infocom friends are here -- Adventure, Deadline, Hitchhiker's Guide to the Galaxy, Zork, and more. Check out Waxy.org (find.macworld.com/0017) for details, or just send an instant message to InfocomBot, InfocomBot2, or InfocomBot3 and choose your game. You can even save and restore just by typing save or restore. And remember: Watch out for grues! -- scholle sawyer mcfarland

Package Fun

With a little tinkering inside packages, you can customize Panther's alert messages and dialog-box text. For example, I changed the message that appears when an application crashes -- "The application has unexpectedly quit" -- to something more appropriate (see below). To customize your message, select Go To Folder from the Finder's Go menu and type /System/Library/CoreServices. Open the CrashSubmitter package and look inside Contents: Resources: English.lproj. Open the crashdump .strings file in TextEdit, change the message to whatever you like, and save it. One problem: the root owns crashdump.strings, so you will be prohibited from saving the change, even though you've logged in as admin. To work around this, launch TextEdit via Pseudo ($15; personalpages.tds.net/~brian_hill/). Alternatively, BareBones' TextWrangler and BBEdit ($49 and $179, respectively; www .barebones.com) let you edit root-owned files. (Save a copy of the original file somewhere in case you mess up.)

Subscribe to the Best of Macworld Newsletter

Comments