Section 9.2. Filesystem Organization

9.2. Filesystem Organization

Mac OS X defines several folders across the filesystem as holding special significance to the system. Individual applications, as well as the system software itself, consult these directories when scanning for certain types of software or resources installed on the machine. For example, a program that wants a list of fonts available to the whole system can look in /Library/Fonts and /System/Library/Fonts . Font files can certainly exist elsewhere in the filesystem, but relevant applications aren't likely to find them unless they're in a predictable place.

9.2.1. Domains

You might also have a /Library/Fonts folder inside your home folder and perhaps yet another inside /Network/Library/Fonts . Each Fonts folder exists inside a separate domain --Mac OS X's term for the scope that a folder resides in (in terms of both function and permission from the current user 's point of view). The system defines four domains :

The term "domain" is a contender for the most overloaded word used to describe Mac OS X. While reading this section, try not to confuse the concept of filesystem domains with that of Internet domain names (such as oreilly.com) or NetInfo domains (as covered in Chapter 10). None of these have anything to do with each other.




User

Contains folders that are under complete control of the current user. Generally speaking, this includes the user's Home folder and everything inside it.



Local

Holds folders and files usable by all users of this machine, which may be modified by system administrators (users in the admin group ) but are not crucial to the operating system. Folders directly under the root directory (/) that don't belong to other domains fall into the Local domain . On most systems, these include the /Library and /Applications folders.



Network

Works like the Local domain, except that its folders are hosted on the network, accessible to users of that network and modifiable by network administrators. Usually, this domain extends to cover all folders (but not the servers) found within the /Network directory.



System

Contains folders and files that exist to support the computer's operating system and are not intended for direct human use. Nobody except the root account has permission to modify anything in the /System domain.

The /System folder contains a typical Mac OS X machine's System domain .

Not every folder on the system lies in a domain. Other users' Home folders, for example, are always out of reach, even for administrative users, and the system has no special use for them. From the current user's point of view, they have no relevance; hence, they have no domain.


When an application needs to scan a system-defined folder for information, it usually seeks that folder in each of these four domains and scans its content, if it exists. The search order it uses is usually as follows :

  1. User

  2. Local

  3. Network

  4. System

An individual application can use a different order if it wishes, but this order suffices for most. It starts at the User domain (the scope where the current user has the most control), continues through the Local and Network domains (where system administrators might have put files for users' shared use), and ends at the System domain (where files critical to the operating system live and whose presence is usually a decision of Apple's).

For example, a program that wishes to find a particular font knows that it can find that font's file in a /Library/Font folder. This folder can exist in any of the four domains, so it scans the directories in the following order:

  1. /Users/ username /Library/Fonts/

  2. /Library/Fonts/

  3. /Network/Library/Fonts/

  4. /System/Library/Fonts/

If it finds the font, it stops its search. If that same application wishes to build a list of all fonts available to the user , it scans all the previous folders in their entirety. In the case of duplicatesfor example, Courier is defined in both the User and System domainsthe earlier domain in the search order (User, in this case) takes precedence.

9.2.2. Special Folders

There are two interpretations of the root directory on Mac OS X: one that's displayed for Finder views, and a Unix one that is mainly accessible from the Terminal. For more information on accessing the Unix root directory from the Finder, see "Exploring root" later in this chapter.

When you click on the icon of the boot hard drive in the Sidebar, you will see the folders listed in Table 9-2. These folders contain essential system files, applications, and the directories for all the system's users.

Table 9-2. Special folders in the root directory

Directory

Domain

Description

Applications

Local, System a

Holds applications available to all users of this machine.

Library

Local

Contains resources available to all users of this machine, such as fonts, plug-ins, and documentation.

System

System

This is the system folder for Mac OS X.

Users

User

Contains user home directories

System Folder

System

This is the system folder for Mac OS 9. Present only if Mac OS 9 is also installed on this volume.

Documents

-

Miscellaneous files from a Mac OS 9 installation.

Applications (Mac OS 9)

-

Applications from a Mac OS 9 installation.

a This folder exists in both the local and system domains. Most of its content belongs to the admin group, but some applications, such as Printer Setup Utility, can't be modified by even admin-group users.


9.2.2.1. User directories

Once created, each user is provided with a series of subdirectories in the home directory ( /Users/ username ). These directories, listed here, can be used for storing anything, although some have specific purposes:



Desktop

This directory contains the items found on your Desktop, including any files, folders, or application aliases placed there.



Documents

While it isn't mandatory, the /Documents directory can be used as a repository for any files or folders you create.



Library

This directory is similar to the /System/Preferences directory found in earlier versions of the Mac OS; it contains resources used by applications but not the applications themselves .



Movies

This is a place to store movies you create with iMovie or can use to hold QuickTime movies you create or download from the Internet.



Music

This directory can store music and sound files, including .aiff , .mp3 , and so on. This directory also stores the iTunes Library.



Pictures

This directory can store photos and other images. iPhoto also uses the ~/Pictures directory to house its iPhoto Library directory, which contains the photo albums you create.



Public

If you enable file or web sharing (System Preferences Sharing Services), this is where you can place items you wish to share with other users. Users who access the /Public directory can see and copy items from this directory. Also in the /Public directory is the Drop Box ( /Public/Drop Box ), a place in which other users can put files for you. If you have file sharing enabled, guest users anywhere on the network can also view and copy from /Public and add items to the Drop Box.



Sites

If you enable Personal Web Sharing (System Preferences Sharing Services), this is the directory that houses the web site for your user account.

9.2.2.2. The Shared user directory

Because users are allowed to add or modify files only within their own home directories, the /Users/Shared directory exists as a place to drop items to be shared with other users on the system. Guest network users can't access this directory.

9.2.2.3. The Library folder

Every domain contains a Library folder. Applications searching for additional resources and software available to it scan through the Library folders in the order noted in the earlier section "Domains."

Library folders hold system-specific application resources. Unlike the application-specific icons, sounds, and other resource files found within an application's package, Library resources are either shared among many applications (as fonts are) or are specific to both individual applications and the current system (as user preference files are).

A running application has access to the resources in all the Library folders within the domains the current user can see. Thus, if the user chris is running an application, the application combs through /Users/chris/Library , /Library , /Network/Library , and /System/Library for resource files. If searching for a particular resource, such as a font or a configuration file, it looks through the folders in the usual User Local Network System domain search order, unless the application specifies a different order.

Anything a user places in her own User domain's Library folder, either directly or through an application, is available to that user alone. For example, all applications on the system are stored in /Applications ; however, a user's preferences for an application are stored in /Users/ username /Library/Preferences , usually as plist files. This separation allows multiple users on the system to use the same applications and yet have a different set of preferences to suit their needs. A system administrator can place resources in the Local domain's Library folder to allow all users of that computer access to them, and a network administrator can place files in the Network domain's Library so that all users of all computers across a network can use them. Nobody should ever need to modify the System domain's Library folder; leave that up to Apple's own system software installer and updater applications.

Mac OS X's Library folders are somewhat analogous to the lib directories found in key places around a typical Unix system, such as /usr/lib and /usr/local/lib . Unix lib directories usually hold code libraries and modules, and Mac OS X Library folders hold frameworks (the dynamic code libraries that Cocoa applications can link to in their Frameworks subfolders ). As this section illustrates, though, Library folders also hold all manner of other application resources.

It's worth noting that a typical Mac OS X system does, in fact, have a number of more traditional Unix lib directories in the usual places, which the underlying Darwin OS uses when compiling software.


The following list briefly describes the folders often found in Library folders. Unless otherwise noted, they might be found in any domain.



Application Support

This folder acts as a "scratch pad" for various applications. By convention, each application creates its own subfolder in this one, within which it can write whatever files it wishes.

Some applications do, however, place their own folders directly underneath the Library folder, rather than in /Library/Application Support . (For example, Apple's iTunes application does this.)



Assistants

Programs that assist with the configuration of other applications or services (also known as wizards ).



Audio

Audio- related resources, including system alerts and audio plug-ins for various applications' use.



ColorPickers

Programs for choosing a color according to various models. The available color pickers appear as choices when an application displays a color well panel (Figure 9-1). Mac OS X's default pickers, including the color wheel, slider, and image-based pickers, live in /System/Library/ColorPickers .

Figure 9-1. A color well panel



ColorSync

ColorSync profiles and scripts.



Components

Miscellaneous components and extensions. This folder tends to exist solely in the System domain.



Documentation

Documentation files. Can be in Apple Help format, plaintext files, collections of HTML, or just about anything else.

As with /Library/Application Support , applications usually place their files within their own, eponymous subfolders.



Extensions

Device drivers and kernel extensions. Appropriate only in the system domain.

Don't confuse the /System/Library/Extension folder with Mac OS 9's /System Folder/Extensions folder. The two are somewhat analogous in that both contain device drivers and low-level system extensions, but Mac OS 9's /Extensions folder often contains all the sorts of things that Mac OS X's Library folders now hold, in one big, unsorted directory.




Favorites

Found only in the User domain, this folder contains aliases to files, folders, and disks.



Fonts

Font files, for both printing and display.



Frameworks

Frameworks and shared code libraries.



Internet Plug-ins

Plug-ins, libraries, and filters used by web browsers and other Internet applications.



Keyboards

Keyboard mapping definitions.



Preferences

Preference files for various applications. Depending upon the domain, these can be for an individual user, or system- or network-wide.

Applications can use whatever file format they wish for storing their preferences. Many modern Mac applications use XML property list files, with a .plist extension; this allows its application to access it through the standard user-defaults programming APIs and allows other applications to see how that application is configured. (Unix's permission system prevents users from spying on one another's config files!)

The files in /Library/Preferences usually apply to system-wide things, such as login window preferences. However, a system administrator can place an individual application's preferences file here to override individual users' preferences for that application.


See Chapter 13 for more information about Mac OS X's preferences system known as the defaults database.



Printers

Printer drivers and PPD plug-ins, organized by printer vendor.



QuickTime

QuickTime components and extensions.



Scripting Additions

AppleScript extensions.



Scripts

Scripts to display under the Script menu extra. The menu extra's content is an aggregation of all the filesystem domains' /Library/Scripts folders. Subfolders show up as submenus.



WebServer

/ Library/WebServer is the default document root of the Apache web server that ships with Mac OS X. See Chapter 12 for more on running Apache.



MAC OS X Tiger in a Nutshell
Mac OS X Tiger in a Nutshell: A Desktop Quick Reference (In a Nutshell (OReilly))
ISBN: 0596009437
EAN: 2147483647
Year: 2003
Pages: 130

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net