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.
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 :
|
Contains folders that are under complete control of the current user. Generally speaking, this includes the user's Home folder and everything inside it.
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.
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.
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 .
|
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 :
User
Local
Network
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:
/Users/ username /Library/Fonts/
/Library/Fonts/
/Network/Library/Fonts/
/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.
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.
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. |
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:
This directory contains the items found on your Desktop, including any files, folders, or application aliases placed there.
While it isn't mandatory, the /Documents directory can be used as a repository for any files or folders you create.
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 .
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.
This directory can store music and sound files, including .aiff , .mp3 , and so on. This directory also stores the iTunes Library.
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.
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.
If you enable Personal Web Sharing (System Preferences Sharing Services), this is the directory that houses the web site for your user account.
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.
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.
|
The following list briefly describes the folders often found in Library folders. Unless otherwise noted, they might be found in any domain.
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.)
Programs that assist with the configuration of other applications or services (also known as wizards ).
Audio- related resources, including system alerts and audio plug-ins for various applications' use.
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 .
ColorSync profiles and scripts.
Miscellaneous components and extensions. This folder tends to exist solely in the System domain.
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.
Device drivers and kernel extensions. Appropriate only in the system domain.
|
Found only in the User domain, this folder contains aliases to files, folders, and disks.
Font files, for both printing and display.
Frameworks and shared code libraries.
Plug-ins, libraries, and filters used by web browsers and other Internet applications.
Keyboard mapping definitions.
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!)
|
See Chapter 13 for more information about Mac OS X's preferences system known as the defaults database.
Printer drivers and PPD plug-ins, organized by printer vendor.
QuickTime components and extensions.
AppleScript extensions.
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.
/ 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.