How Documents Know Their Parents

Every operating system needs a mechanism to associate documents with the applications that created them. When you double-click a Microsoft Word document icon, for example, it’s clear that you want Microsoft Word to launch and open the document.

So how does macOS know how to find a document’s mommy? It actually has two different mechanisms:

  • File name extensions. A file name extension is a suffix following a period in the file’s name, as in Letter to Mom.doc. (It’s usually three letters long, but it doesn’t have to be.) These play a role in determining which documents open into which programs.

    That’s how Windows identifies its documents, too. If you double-click something called memo.doc, it opens in Microsoft Word. If you double-click memo.wri, it opens in Microsoft Write, and so on.

    Note

    MacOS comes set to hide most file name extensions, on the premise that they make the operating system look more technical and threatening. If you’d like to see them, however, then choose Finder→Preferences, click the Advanced button, and then turn on “Show all filename extensions.” Now examine a few of your documents; you’ll see that their names display the previously hidden suffixes.

    You can hide or show these suffixes on an icon-at-a-time basis, too (or a clump-at-a-time basis). Just highlight the icon or icons you want to affect, and then choose File→Get Info. In the resulting Info window, proceed as shown in Figure 6-18.

    Bottom: If you try to add a suffix of your own, ...

Get macOS Sierra: The Missing Manual now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.