A Gmail-MacOSX Tip

Greg has been suggesting that this is a good forum to share brief tidbits of computer wisdom whenever I run across them. (That wonderful resource of Macintosh advice, MacOSXHints, might really be the more appropriate place, and for all I know this hint is up there.)

So, here is a relatively simple, but very annoying, problem: If you use gmail or some other web-based e-mail service with your web browser (say, Safari or Firefox, as opposed to a dedicated mail client like Apple Mail or Entourage, both of which take care of this problem for you automatically), and you try to attach a document to a message, you may well find that the browser will neither save nor send that message. Indeed, it may look like gmail is trying to send the file (with its little red javascript “saving” notice in the top right corner of the window), but it will never complete the task.

If you have been left hanging in this manner, I have an explanation for you (and, as a bonus, a really simple solution too!).

The problem is that the “file” you are trying to send is not in actuality a file at all but a “bundle”: a folder [or, for you PC/UNIX folks, a directory] full of files posing as a single file.

MacOSX frequently uses bundles for applications and, in rarer cases, documents in order to hide an array of little constituent files that make up a single program or document file. They do this so that you can double-click on the “file’s” icon and open the document and/or application you expect, instead of merely revealing the contents of a folder full of little constituent files and subfolders. {{There are also technical reasons for breaking up a file into multiple subfiles; OmniOutliner, for instance, stores the actual content of its data file in a standard .xml file within a compact looking OmniOutliner file bundle. In the old MacOS, prior to “X”, files often were packaged as binaries, with a “data fork” holding the text content and a “resource fork” containing miscellaneous metadata and formatting information. In essence, then, this folder-posing-as-a-file, the MacOSX bundle, was ginned up to simulate the old Mac binary fork technique while complying with UNIX file structures that were designed for directories/folders and files, and not these hermaphroditic/schizophrenic forked files.
By the way, many programs leave their document files as simple files, particularly if they are interested in cross-platform portability, such as the Microsoft office .doc file, which can be e-mailed without any trouble at all.}} So, simply put, the bundle in MacOSX functions like the bindings on a book — enabling you to see at a glance at the spine what the text is called and, what’s more, handily pull a compact and unified volume off a shelf instead of ending up with a loose sheaf of separate and discrete sheets of paper.

Unfortunately, although your web browser will treat a bundles as a single file when you click the “attach file” button on gmail’s compose message webpage, gmail itself cannot upload or send whole folders, only individual files. What is happening is that Gmail is expecting a file here, and is really getting a whole directory full of files, so it gets confused and becomes unresponsive. You would think they could figure this problem out, either the geniuses at Google or the smart-but-human programmers behind the major web browsers, but they apparently can’t.

So, you are left to do what Safari or gmail should probably have figured out how to do automatically: Turn that pseudo file bundle into a real, honest, cross-platform unitary file. Fortunately, this is really easy to do yourself, assuming merely that you are using some version of MacOSX 10.4 (I cannot recall if this worked so easily in 10.3).

  1. Before clicking that “attach file” button in gmail, select the troublesome bundle file in the Finder and evoke the contextual menu (right click or CTRL-click on it). In that context menu, you should find the option to “Create archive of [the file name]”. Do it.(This will make, without touching your original file bundle, a new file in that same folder. This new file, which will be a unitary, honest-to-goodness-file is a zip archive (it will have “.zip” at the end of its name). These files can later expanded on any computer, Mac, PC, or Linux, without any trouble.)
  2. Since it is a real file, gmail will be happy to attach it, upload it, and mail it off for you after you select it with the “attach file” button. Make sure you choose the .zip archive in that file selection dialog box!
  3. After you are done with that, and the message has been successfully sent, feel free to delete the .zip file (your original bundle file will be untouched).

Of course, this simple procedure works if you just want to e-mail a normal folder full of files as well! The bottom line is that zipping a file or folder (i.e., embedding it in a .zip archive) packs the data together and armors it for transit, helping it survive through e-mail or over the web. As a bonus, this process will also make the file/folder a bit smaller, which is nice too (and which was the original purpose for the .zip archive format). Enjoy.

One Response to “A Gmail-MacOSX Tip”

  1. Greg Says:

    Great tutorial, Jem. Even though I’d already come across this problem and its solution (probably from talking to you), I don’t think I ever actually knew what was really going on at the filesystem level. Super clear explanation of complicated stuff!

Leave a Reply