- Table of Contents
- Copyright
- About the Author
- Acknowledgments
- Tell Us What You Think!
- Introduction
- Part I: Introduction to Mac OS X
- Chapter 1. Mac OS X Component Architecture
- Chapter 2. Installing Mac OS X
- Chapter 3. Mac OS X Basics
- Chapter 4. The Finder: Working with Files and Applications
- Chapter 5. Running Classic Mac OS Applications
- Part II: Inside Mac OS X
- Chapter 6. Native Utilities and Applications
- Chapter 7. Internet Communications
- Chapter 8. Installing Third-Party Applications
- Part III: User-Level OS X Configuration
- Chapter 9. Network Setup
- Chapter 10. Printer and Font Management
- Chapter 11. Additional System Components
- Part IV: Introduction to BSD Applications
- Chapter 12. Introducing the BSD Subsystem
- Chapter 13. Common Unix Shell Commands: File Operations
- Part V: Advanced Command-Line Concepts
- Chapter 14. Advanced Shell Concepts and Commands
- Chapter 15. Command-Line Applications and Application Suites
- Chapter 16. Command-Line Software Installation
- Chapter 17. Troubleshooting Software Installs, and Compiling and Debugging Manually
- Chapter 18. Advanced Unix Shell Use: Configuration and Programming (Shell Scripting)
- Part VI: Server/Network Administration
- Chapter 19. X Window System Applications
- Chapter 20. Command-Line Configuration and Administration
- Chapter 21. AppleScript
- Chapter 22. Perl Scripting and SQL Connectivity
- Chapter 23. File and Resource Sharing with NetInfo
- Chapter 24. User Management and Machine Clustering
- Chapter 25. FTP Serving
- Chapter 26. Remote Access and Administration
- Chapter 27. Web Serving
- Part VII: Server Health
- Chapter 28. Web Programming
- Chapter 29. Creating a Mail Server
- Chapter 30. Accessing and Serving a Windows Network
- Chapter 31. Server Security and Advanced Network Configuration
- Chapter 32. System Maintenance
- Appendix A. Command-Line Reference
- Appendix B. Administration Reference
Disk Utilities
Mac OS X includes two utilities that you'll commonly use when working with disks: Disk Utility and Disk Copy. The Disk Utility application combines the features of Disk First Aid and Drive Setup from Mac OS 9. Disk Copy is used to mount virtual disks—a popular way to distribute software under Mac OS X.
Disk Copy
Disk Copy (Path: /Applications/Utilities/Disk Copy) works in much the same way as the Disk Copy program used by Apple in OS 8/9. In recent years, Disk Copy has become a common and convenient way to distribute software. Rather than creating an archived folder, developers write their applications to a virtual disk that is loaded into memory when used. This disk appears to the computer as a real disk, and can be manipulated like any other disk. For the end user it is a simple way to work with new applications. A single disk image file can contain applications, support files, and any other data a program might need—and it never needs to be decompressed. In fact, many applications can actually run directly from disk images, without needing to be copied to your hard drive at all. Disk Copy even has built-in CD burning capabilities to make turning a disk image into a real CD a matter of a few clicks.
To launch the Disk Copy application, double-click it, double-click a disk image file (usually .dmg), or drag an image file onto its icon. The idle state of the Disk Image application is shown in Figure 6.8.
Figure 6.8 Disk Copy is waiting for a disk image…
To mount an image, either use Mount Image from the File menu or drag a disk image onto the Disk Copy window. The application will check the validity of the image (its checksum), and then it will appear as a white drive icon on your desktop, or at the computer level of the Finder, as shown in Figure 6.9.
Figure 6.9 Mounted images appear just like any other disk.
If you launched Disk Copy by dragging an image file to its icon, or double-clicking an image file, the image will be automatically mounted.
From this point, you can copy files from the disk to wherever you'd like, or use them directly from the mounted image.
Creating Disk Images
With Mac OS X 10.1, Disk Copy can now create images as well as mount them. This is useful for creating an exact duplicate of software you don't want to lose, or for making a master image for distributing software over a network. For each image you create, you must have the appropriate amount of free space on your hard drive. For example, to create a CD image, you'll need approximately 650MB free. Apple's currently shipping computers come with at least 10GB drives, so this really shouldn't be an issue.
There are two ways to generate an image: by copying an existing volume/partition, or by creating an empty image file, mounting it, and then copying files to it. To create an empty image file, choose New Blank Image (Command+N) from the Image menu. The dialog box is shown in Figure 6.10.
Figure 6.10 Generate a new image blank image; then copy files to it.
Fill in the Save as field as you normally would—this is the name of the image file, not the volume that is going to be created. Set the name of the volume within the Volume Name field. Choose a size for the image from the Size pop-up menu. There are a variety of preset sizes for common media—such as Zip disks, CDs, and DVDs—and a Custom setting for arbitrary sizes.
Next, choose a volume format with the Format pop-up menu. In addition to the HFS, HFS+, and UFS options supported as native Mac OS X file systems, you can also choose MS-DOS to create a Windows-compatible title.
Finally, if you'd like to encrypt the disk image, choose AES-128 from the Encryption pop-up menu, and then click Create. The new disk image will be created and can be used immediately.
Creating an image from an existing drive is even easier. Choose New Image From Device (Shift+Command+I) from the Image menu. Disk Copy will display a list of all active devices, as shown in Figure 6.11. Click the disclosure arrow in front of each device to display the individual partitions.
Figure 6.11 Choose the device and partition to use as a source.
Select the drive or partition to image, and then click the Image button. You will be prompted for the location to save the image. Using the Image Format pop-up menu, choose the type of image to create: read-only, read-write, compressed, or CD/DVD master. Apply encryption to the image file by choosing AES-128 from the Encryption pop-up menu.
Finally, click Image to copy an image of the device onto your hard drive.
Burning CDs
To burn a CD from within CD Copy, you must have your CD writer connected and powered on. Check Apple's Web site for supported writers. Because Mac OS X provides an API for CD writing, the iTunes Web page should be a good gauge for what will and won't work with your system (http://www.apple.com/itunes).
Select Burn Image from the Image menu, and choose a disk image file when prompted. If the image is suitable for CD burning, Disk Copy will display the dialog shown in Figure 6.12.
Figure 6.12 Insert a CD and click Burn.
Choose the maximum speed you want to use during the burn process, along with whether you'd like to verify and eject the disk after it has finished. If you prefer to test everything before risking a CD, click the Test Burn check box, and no data will actually be written to the disk.
When you're satisfied with your settings, click the Burn button, and Disk Copy will begin writing the CD.
Preferences
The Disk Copy Preferences window consists of five individual panels: Verifying, Creating, Imaging, Burning, and General. By default, the Verifying pane will be displayed when you first open Preferences, as shown in Figure 6.13.
Figure 6.13 Use verifying options to disable image verification.
When an image is mounted, Disk Copy verifies the checksum on the each drive. If you'd prefer to forego the verification of checksums, deselect Verify Checksums. In addition, clicking the Ignore invalid checksums box will allow images that do not verify correctly to be mounted. This could be useful for recovering data from corrupt images.
Disk Copy does not check images on file servers, nor on locked media. To force checking on all types of storage media, uncheck both the on remote volumes and on locked media check boxes.
To adjust the default disk image settings, use the Creating preference panel, shown in Figure 6.14.
Figure 6.14 Choose the default volume format for new images.
Here, you can configure the defaults for new images that are created. The Volume Format, Volume Size, and Encryption settings are identical to those discussed earlier.
Similar to the Creating panel is the Imaging preference window panel. These options, displayed in Figure 6.15, configure how the image file is saved to your drive.
Figure 6.15 Pick image segment size, type, and more.
Again, the same Image Type and Encryption options are presented as were mentioned previously. A Segment Size pop-up menu is also provided to divide up a maximum disk image file size when creating a new image. If the image exceeds this size, it is divided into multiple file segments.
Click the Mount afterwards check box to automatically mount an image after it is created.
Switch to the Burning panel to set up how Disk Copy will interact with your CD burner when writing an image. These options are demonstrated in Figure 6.16.
Figure 6.16 Burning options control interaction with the CD burner.
By default, CD burning will start by prompting the user. To disable these messages, uncheck the Confirm burn check box. Use the Preferred Speed pop-up menu to pick the speed at which your CD will be written. The Verify after burn setting forces a CD to be checked for errors after being written. Finally, click Eject when finished burning to have your computer automatically eject each completed and verified CD.
The final setting panel, General, determines how the Disk Copy program will act after it is running, as seen in Figure 6.17.
Figure 6.17 Choose how Disk Copy will react after starting.
By default, if you double-click an image file, Disk Copy will start, mount the image, and then quit. If you prefer to keep the application open, click Stay open after starting up. To log activity within Disk Copy, use the two logging check boxes to generate a usage log with time and date information.
Menus
The Disk Copy menus are straightforward. The File menu contains the standard set of options, but also includes the ability to display and clear the Disk Copy log files.
Using the Image menu, users can create, verify, and convert image files:
- New Blank Image (Command+N)— Creates a new blank image file which can later be written to like a Mac OS X disk.
- New Image from Device (Shift+Command+I)— Creates an image file by making a direct copy from a storage device or partition.
- Convert Image (Command+K)— Converts an existing image file to a new format.
- Burn Image (Command+B)— Burns a CD from an existing image file.
The Utilities menu offers two options: the ability to calculate (Option+Command+=) and verify (Command+-) device checksums. After calculating a checksum for your drive image, you can provide the information to users who download or receive your image files. This, in turn, can be used to verify that an image file is indeed the original.
Disk Utility
Disk Utility (Path: /Applications/Utilities/Disk Utility) combines disk repair with disk formatting and partitioning. As with Mac OS 9, you cannot use either of these functions on your startup partition. If you only intend to work with a secondary disk or partition, launch Disk Utility from the Finder. To use Disk Utility to work on your primary disk, follow these steps:
- Insert your Mac OS X Install CD into your computer.
- Start (or restart) your Macintosh while holding down the C key.
- Wait for the Installer to boot.
- Choose Open Disk Utility from the Installer application menu.
After launching Disk Utility, the application will open to the first of five different panels: Information, First Aid, Erase, Partition, and RAID. Each panel performs a different function within the application, as you might guess from each panel's name.
Along the right side of the window are the available storage devices on the system, including mounted disk images. If a device has a disclosure arrow located to the right of its icon, it can be expanded to display available partitions.
Choose the disk or partition that you want to work with, and then click the tab to move to the appropriate panel. We'll start with the Information panel.
Information
Shown in Figure 6.18, the Information panel displays data about the currently selected resource, but does not perform any operations on the device.
Figure 6.18 The Information panel supplies data about the selected resource.
If a storage device is chosen, the information display reflects the physical statistics of the hardware—such as manufacturer, capacity, and how it is connected (ATA, SCSI, Firewire, and so on).
Choosing a partition within a storage device reveals even more data, including the mount point (usually /Volumes/ <partition name> ), format, capacity, available space, used space, and the total number of files and folders.
First Aid
The First Aid panel, shown in Figure 6.19, can perform basic repair operations on a drive. It functions on UFS, HFS+, and HFS volumes—meaning that you can repair both types of Mac OS X partitions and both types of Mac OS 8/9 partitions. Unfortunately, Disk First Aid is not capable of repairing extensive disk damage, so third-party utilities such as Micromat's Drive 10 and TechTool Pro (http://www.micromat.com/) are still important parts of every software library.
Figure 6.19 Use Disk First Aid to repair damaged volumes.
To check or verify a disk, select the disk and partition from the volume list at the right of the window. Next, click the appropriate action button:
- Verify— Displays any errors found in your disk, but does not attempt to repair them.
- Repair— Performs the same tests as Verify, but automatically fixes any errors it might find.
- Stop— Halts the current action (Verify or Repair).
If errors are found, they will be reported. Several things are checked during this process:
- Extents Overflow File— The Extents file keeps track of file information that could not be placed contiguously on a disk. As files become fragmented, the locations of the fragments are stored here.
- Multi-Linked Files— Files that are incorrectly linked to the same allocation blocks on the disk.
- Catalog— Contains the information that forms the structure (files, folders) of the disk.
- Bitmap— A binary picture of the disk, which records which blocks are allocated to files and which are free space.
If errors cannot be repaired, Disk Utility will warn you that it is incapable of fixing your system. If this happens, try rerunning the repair—Disk First Aid often requires two passes to work correctly. If the repair does not work, Apple's suggested course of action is to back up the drive, erase it, and then restore your files. I'd recommend trying another disk repair tool before resorting to such desperate measures.
Erase
The next panel, Erase, does exactly what you would think it should: It erases drives and partitions. This is essentially a quick-and-dirty partitioning and initialization tool; it creates a single empty partition on the selected device and erases anything that was previously there. The Erase panel is shown in Figure 6.20.
Figure 6.20 The Erase panel is used to quickly erase volumes and create a single empty partition.
Use the Volume Format pop-up menu to choose between HFS+ (Mac OS Extended) and HFS (Mac OS Standard) partition types. If you intend to use the volume within Mac OS X, you should use the Mac OS Extended format.
Next, enter a name for the new volume. This will appear as your disk label on the desktop. If the drive will be used with Mac OS 9 directly (not through the Classic environment), you can install Mac OS 9 drivers by clicking the Install Mac OS 9 Drivers check box.
Finally, click Erase to remove all existing information from the device and install the selected file system.
Partition
To create a more complex drive layout, use the Partition panel. If you used Drive Setup in Mac OS 8 or 9, the Partition panel will look familiar. Shown in Figure 6.21, this is the control center for working with your drive. More information on partitions, and what they are can be found in Chapter 2, "Installing Mac OS X." Be warned, changes here will erase any information on the target drive!
Figure 6.21 Partitioning your drive will erase any existing information.
The Volume Scheme section of the Partition panel contains a visual representation of the partitions on the system. Each box is a partition. The highlighted box is the active partition.
You can change a partition's size by dragging the dividers between the partitions up and down to shrink or grow the available space. As you drag the bar, the size field on the right portion of the panel will change to show the current settings.
In addition to working with the visual view of the partition, you can use the various pop-up menus, fields, and buttons to set other parameters:
- Scheme— Quickly divides your drive into 1–8 equally sized partitions.
- Name— Sets the name of the highlighted partition.
- Format— Sets the highlighted partition to be either HFS, HFS+, UFS, or free space.
- Size— Manually enter a new size for the selected partition.
- Locked for editing— When checked, the Locked for editing setting freezes the current partition's settings. You can continue to work with other partitions, but not one that is locked. Clicking the lock icon in the visual view of the partitions also toggles the lock.
- Split— Splits the current partition into two equally sized partitions.
- Delete— Removes the active partition.
- Revert— Returns the partition map to its original state.
- Partition— Commits the partition table design to the drive. This destroys all current data on the device.
Clicking the Partition button is the final step to designing your volume's layout. After you click the Partition button, you'll be prompted with a final confirmation, and then the changes will be written to the disk.
RAID
Unfortunately, the RAID feature was not yet complete in the version of Mac OS X reviewed for this title. By adding RAID support directly within the Mac OS X system, Apple is setting a new standard for high-end server and user applications.
RAID, or Redundant Array of Independent Disks, is a collection of multiple drives that function together as a single drive. By using drives performing in parallel, the computer can write and read information from the RAID set at a much higher rate than a single drive. There are four common types of RAID available:
- Level 0 – Disk striping— This increases I/O speed by reading and writing to multiple drives simultaneously. It offers no fault tolerance.
- Level 1 – Disk mirroring— Creates a fault-tolerant system by creating an exact mirror of one drive on another drive.
- Level 3 – Disk striping with error correction— This RAID type uses three drives: two operating identically to level 0, a third containing error correction information for fault tolerance.
- Level 5 – Striped data and error correction— RAID level 5 offers the best balance between performance and fault tolerance.
The Mac OS X RAID capabilities are easy to configure if you have multiple drives within a machine. The setup screen is shown in Figure 6.22.
Figure 6.22 RAID support greatly enhances the credibility of Mac OS X as a serious platform.
To set up a RAID set, drag the icons of the drives to add to a set from the volume list to the RAID panel's disk listing. Using the RAID scheme, choose what type of RAID support will be enabled for the disks, and provide a name for the resulting virtual drive that will represent the combination of devices.
Finally, choose a volume format for the RAID set—this is identical to the choosing a format for any volume—and click the Create button to generate the RAID set.
The new volume will be mounted on the desktop.
Menus
The Options menu contains the only additional features for the Disk Utility application. After selecting a disk from the list, you can choose to Mount (Command+M), Unmount (Command+U), or Eject (Command+E) the volume.
Apple System Profiler
The Apple System Profiler (Path: /Applications/Utilities/Apple System Profiler) is a tool for browsing the hierarchy of components in your computer, connected to your computer, and installed on your computer. A typical use of this utility (which is also included in Mac OS 9) is to provide detailed configuration information for error reports to hardware and software manufacturers. Other uses include surveying the applications that are installed, along with their version information ad checking the status of USB or FireWire devices that are plugged into your machine.
The profiler will collect information about your computer when initially launched. This can take some time, so be patient. The initial display is a summary of your system configuration, as shown in Figure 6.23.
Figure 6.23 The System Profiler collects and displays your system's hardware and software configuration.
Each of the categories can be expanded or collapsed by clicking the disclosure arrow in front of the topic. Disclosure arrows are used extensively throughout the application, so be sure to click around—you'll be surprised at the total amount of available information.
A total of five categories of information are available: System Profile, Devices and Volumes, Frameworks, Extensions, and Applications. Click the appropriately labeled tab to move between the topics.
To generate a report of all the information generated by Apple System Profiler, choose New Report (Command+N) from the File menu.
System Profile
The System Profile panel, which was displayed in Figure 6.23, contains a summary of the base computer and operating system. By expanding each of the subtopics, you can find everything from the amount of built-in memory and your current network configuration to the serial and sales order number that was assigned when your machine was first built.
Devices and Volumes
To see the devices that are connected to your computer (including the internal disks and storage devices), click the Devices and Volumes tab. An example of this screen is displayed in Figure 6.24.
Figure 6.24 Devices and Volumes shows a tree of the devices on your system busses.
The Devices and Volumes display is unique—instead of a linear view of the connected devices, it presents the data as multiple trees, with each of your system busses at the base:
- USB— Universal Serial Bus, a slow (12Mbps) bus used for connecting external peripherals such as low-speed storage, scanners, printers, cameras, mice, and keyboards.
- FireWire— An Apple-developed bus technology that supports speeds of 400Mbps, hot swappable devices such as high-speed storage and digital-video cameras. The FireWire bus is also known by its IEEE name 1394 and Sony's iLink.
- PCI— Peripheral Component Interconnect. The PCI bus was developed by Intel (yes, that Intel), and is the standard for connecting internal video cards, sound cards, and so on.
- EIDE— Enhanced Integrated Drive Electronics. The EIDE standard was developed by Western Digital and is used for internal CD-ROM and disk storage.
- SCSI— Small Computer System Interface. An extremely fast bus for high-speed storage devices, typically used on server-class computers.
By following the tree from the base, you can examine the devices that are connected, the manufacturer of the device, and the drivers that are installed.
Frameworks
Selecting the Frameworks tab displays a list of libraries that are installed on your computer, along with the version, and whether the Framework is an Apple creation. A sample of this screen from a default OS X installation is shown in Figure 6.25.
Figure 6.25 Frameworks provide functionality for various portions of the operating system.
There are dozens of frameworks in the base installation of Mac OS X—ranging from AppleShare to Speech Recognition. Similar to the other panels, you can click the disclosure arrow in front of the framework to show the name of the library, general information, copyright, and version. Again, this data is really just useful for debugging purposes. If a framework has accidentally been replaced with an older version, it is likely to cause problems with the system. The Frameworks panel can be used to quickly view the version numbers for comparison.
Extensions
Extensions, like frameworks, provide functionality to the operating system. Unlike frameworks, they work directly with the hardware to enable the operating system to access devices such as network cards, sound cards, and other components. Mac users are familiar with Extensions. In Mac OS 8 and 9, extensions had similar capabilities but often made the operating system unstable. In Mac OS X, the traditional extension is replaced by a .kext (kernel extension). These plug-ins for the mach-kernel cannot be installed by unprivileged users and are no longer appropriate or useful for creating cool (but crash-causing) additions to the system.
The layout of the Extensions view is identical to that of the Frameworks. Each extension is displayed, along with its version, and an identifier to determine if it is Apple software. Similar to the other views, you can click the disclosure arrow to display detailed information about each kernel extension.
Applications
Finally, the Applications panel scans your drive to display all the installed applications (the BSD subsystem utilities are not taken into account). Like the Extensions and Frameworks views, you can use the basic list to determine the version and creator of an application—or expand an object to show full program information such as copyright and build status.
Preferences
The Apple System Profiler can create extensive reports based on the information gathered from the system. The output format and contents of the default report are configured from the Preferences panel in the Application menu. The default preferences are shown in Figure 6.26.
Figure 6.26 The Preferences set up the default reporting style for Apple System Profiler.
Using the System Profiler preferences, you can enable reporting on these portions of your system:
- System Profile— By default, only the basic System Profile is enabled. You can deactivate the entire profile or individual components (Software, Memory, Hardware, Network, Production, and so on) by clicking the check boxes in the list.
- Device and Volumes— Click to toggle generation of the Device and Volumes information.
- Frameworks— Click to toggle generation of the Frameworks report information.
- Extensions— Click to toggle generation of the Extensions report information.
- Applications— Click to toggle generation of the Applications information.
- Gather Extension/Framework/Application information at launch— If checked, the Profiler will search your drives at launch for the installed components. This process can take several minutes.
- Save window location and size— If checked, saves the Profile window's settings between uses.
- View reports as Apple System Profile document— If selected, the reports are generated using the same graphic layout as the Profiler itself. This is not useful if the report needs to be sent as plain text.
- Show expanded information— Shows all information for each object in the Profiler report.
- View reports as Text document— Saves the report in a text-only format, suitable for e-mailing or pasting into other applications.
Click OK to apply and save your settings.
Menus
Two menus that provide some additional functionality beyond what can be accessed directly in the profiler window are the File and Commands menus.
The File menu operates on reports that are generated from the Profiler's data. You can use the regular Open command to open existing report files, Save to save and open the report window, and the Print function to print and open the report window.
The Commands menu controls the Profiler's scanning of your drive information. Scanning can often take quite awhile, and, if stopped, must be resumed to get an accurate report. This menu enables the user to control the scanning process.
- Gather remaining information (Command+G)— Performs all necessary scanning for frameworks, extensions, and applications.
- Update all information (Command+U)— Rescans all portions of the profile for updated information.
- Update Frameworks/Extensions/Applications (Command+R)— Rescans the system components for updates.
- Search options(Command+F)— Configures the drive scanning options, shown in Figure 6.22.
- System Profile (Command+1)— Switches to the System Profile panel.
- Devices and Volumes (Command+2)— Switches to the Devices and Volumes panel.
- Frameworks (Command+3)— Switches to the Frameworks panel.
- Extensions (Command+4)— Switches to the Extensions panel.
- Applications (Command+5)— Switches to the Applications panel.
Choosing the Search options selection enables you to limit the drives and partitions that are included when scanning your computer. Figure 6.27 shows the Search options configuration.
Figure 6.27 Search options set the devices that will be scanned when profiling your system.
Click through each of the three tabs (Frameworks, Extensions, and Applications) and click the check box beside each drive or partition that you want to scan. If a box is checked, the drive will be scanned. Scanning large volumes can be very time-intensive, so limit the scans to only the volumes that are used for applications and the operating system. Click OK to apply your choices.
The System Profiler provides an overwhelming amount of information and is rarely needed on a regular basis. In the event that a peripheral is not recognized, it can provide an easy means of identifying whether the problem is related to a missing driver, an inappropriate version of the support software, or perhaps a complete lack of communication on the peripheral's bus.
Console
The Console application (Path: /Applications/Utilities/Console) is literally a window into the other side of Mac OS X. While the system is running, the GUI hides a tremendous amount of information from the user. Important information is sent to what is called the Unix Console device (/dev/console). On many Unix systems, the console actually is a separate device, such as a VT100 terminal display that displays any data sent to it. This exists as a virtual device on Mac OS X and is responsible for reporting information as it arrives.
The Console application enables you to watch error and status messages as they appear. If your computer appears to be stalled or is acting in an unusual manner, the Console might be producing information that can help debug the problem. A screenshot of the Console application is shown in Figure 6.28.
Figure 6.28 The Console shows internal system error and status messages as they appear.
Even on a properly working Mac OS X system, the Console will generate messages. You'll usually see a large amount of information related to the lookupd process. lookupd is a system process that handles network DNS service, user information lookups, and anything else that accesses the Mac OS X NetInfo database. Each request for information from lookupd is given a time-to-live. If that time is exceeded, the request fails and is logged to the console. In a networked environment, such failures are commonplace and the system will simply repeat the action until it succeeds.
In addition to lookupd, the Mac OS X WindowServer is another process you're likely to see popping up in the console. The WindowServer provides the base windowing and event model for Mac OS X. As I mentioned earlier, even on a working system, you're likely to see a number of error messages logged by these two processes. This does not mean that your system is incorrectly configured.
The Mac OS X System maintains a great deal of log information in addition to what is sent directly to the console. The Console application can display the contents of any log that you'd like. As you read through the book, you'll find that many of the BSD services create their own log files.
Preferences
The Console application preferences window contains two panels: Logs and Crashes. The Logs panel is shown in Figure 6.29.
Figure 6.29 The Console can automatically appear and disappear as information arrives.
Here you can choose the number of lines (from the end of the log file) that will be displayed. You can also pick a delay that will be used for displaying log information as it comes in. If the console application is running but hidden when incoming information is received, the application will appear and display the new information. The Display text for xx seconds, then re-hide field is used to set the length of the delay before the Console application will hide itself.
Click the Remember log window sizes and locations check box to have the Console application remember exactly where you left it between executions.
The second Console panel, Crashes, is used to log information about system and application crashes. By default, logging is disabled. Click the Log crash information check box to begin collecting the log data. To automatically show the Console application when a crash occurs, be sure to check the Automatically display crash logs option.
Menus
The Console application's menus can be used to load windows with additional log file data, or change the formatting of an existing window. You won't be too surprised by some unusual elements in the menus, if you've read the earlier information on Stickies.
The File menu opens and manipulates log files. It can be used to reload or print the contents of an open window. The File menu options include
- Open Log (Command+O)— Opens a log file on your Mac OS X System. By default, the application moves to the /var/log directory, which contains most of the system logs.
- Open Console (Shift+Command+O)— Opens the Console window.
- Reload (Command+R)— Reloads the contents of the currently active window.
- Clean (Command+K)— Clears the contents of the currently active window.
- Print (Command+P)— Prints the contents of the currently active window.
The Format menu provides control over the way text lines are displayed in the console and log windows. In fact, because of the nature of the Mac OS X operating system, you might find greater control over the output than in word processors and page layout applications. The following options can be found in the Format menu:
- Font— The font submenu is, frankly, amazing. It provides access to the entire Mac OS X Font system (discussed in Chapter 10, "Printer and Font Management") including features such as kerning and ligature. Your log files never looked so… pretty.
- Wrap Lines (Shift+Command+W)— Wraps lines that exceed the length of the window. If deselected, the log output will be easier to read, but you'll most likely need the horizontal scrollbar to see it all.
CPU Monitor
With the multitasking capabilities of Mac OS X, users might want to check just how much of their computer's processor time is being used. In Mac OS 8 or 9, if your computer was unresponsive for a few minutes (or hours), you were pretty sure that it was busy. Mac OS X's pre-emptive multitasking is a bit more difficult to gauge. Running software like Seti@Home might take up large amounts of your CPU, but the system still remains snappy.
The CPU Monitor (Path: /Applications/Utilities/CPU Monitor) can graphically display the usage of your CPU on a simple graph from 0 to 100%. If you have multiple processors, a graph will be displayed for each CPU in your machine.
The CPU Monitor supports three different types of graphs that can be displayed in a number of different ways (configurable through the Preference panel and Processes menu).
Most users will be comfortable with the Standard view. In this mode, the CPU monitor displays a window with a vertical graph of the CPU activity. If you prefer to keep the monitor visible at all times, choose the Floating Window view, which creates just the graph itself as a floating image that can be positioned anywhere on the screen—including the menu bar! An alternative to the floating window is the Icon view. This view takes advantage of the Dock's ability to display dynamic information in its icons. The CPU activity is graphed within the CPU Monitor's Dock icon, rather than taking up additional screen space (see Figure 6.30).
Figure 6.30 The CPU Monitor can display usage in a number of ways and places.
Advanced users might want to choose the Expanded Window view. When using the expanded mode, the graph displays information about user, system, and nice processes. This is usually necessary only for those making use of the BSD subsystem and/or background server processes.
The Standard and Floating views use an average of the overall system activity in their graph. The Expanded view differentiates between three different types of activity:
- System— Processor usage by the system processes, such as the WindowServer and other components of the operating system. The System CPU time often correlates directly to the user activity. Dragging objects within an application, for example, places a load on the application and on the Mac OS X graphics and event- processing subsystem.
- User— CPU time that is used by user-started processes and applications.
- Nice— CPU time used by processes running with an altered scheduling priority. All user processes start with the same priority of execution. This priority can be adjusted with the nice and renice commands to provide them with more or less access to CPU time.
You can control the windows displayed, their orientation, and appearance through a combination of Preference settings and the use of the Processes menu.
CPUMonitor Preferences
The CPUMonitor Preferences can set appearance attributes for the floating and expanded views of the CPU Monitor, as well as configure the monitor to display with the Dock icon, as opposed to a separate window. The Preferences window is shown in Figure 6.31.
Figure 6.31 The CPUMonitor Preferences control the appearance of the CPU graphs.
The CPUMonitor Preferences panel has three separate panels. The first, the Floating View, includes
- CPU Display color— Click the color well to choose a color for the Floating monitor's graph.
- CPUMonitor Transparency— Use the radio buttons to set the floating view to No Transparency, Slight Transparency, or Heavy Transparency.
- Display view— The floating CPU monitor can display as a vertical (default) or horizontal graph based on these radio buttons.
The second section of the CPUMonitor Preferences, the Expanded View settings, enables the user to configure the colors that she wants displayed for background of the view window and the three types of CPU activity. Click each color well to open the OS X Cocoa color picker and choose a new color.
The final tab, Application Icon, chooses which CPU Monitor graph will be drawn within the Dock; choose either Display the Standard view in the icon or Display the Extended view in the icon. The corresponding graph will be drawn directly in the CPU Monitor's Dock icon. Choosing Don't display in the icon will revert to the default static Dock icon.
Menus
The Process menu provides access to the remaining CPU Monitor options. Here you can toggle the different monitor modes as well as launch related programs.
- Display Standard Window (Command+S)— Displays the standard (single color) CPU Monitor graph.
- Toggle Floating Window (Command+F)— Toggles the floating graphic on and off.
- Display Expanded Window (Command+E)— Displays the expanded (four-color) CPU Monitor graph.
- Clear Expanded Window (Command+K)— Clears the activity shown in the expanded window.
- Open Process Viewer (Command+P)— Launches the Process Viewer application (see the next topic in this chapter).
- Open Top (Command+T)— Launches the Terminal application running the command-line utility top, which monitors system processes and activity.
The CPU Monitor can give you new insight into your computer's internal processes. If the system seems slow, the CPU Monitor can reveal whether or not the CPU is being taxed, or if the problem lies elsewhere.
Process Viewer
In Chapter 4, "The Finder: Working with Files and Applications," you learned how pressing Option+Command+Escape opens a process list and enables you to force-quit open applications on the system. The Process Viewer application is similar, but contains information on all the system's processes, not just the GUI software that is running. Figure 6.32 shows the default Process Viewer display.
Figure 6.32 The Process Viewer can show you everything that is running on your computer.
Using the controls in the Process Listing screen, you can configure the type of output and amount of the information displayed.
The Find and Show features help limit the amount of data that is shown within the process listing. Typing into the Find field filters processes, which match the given string. For example, typing Internet would limit the displayed processes to those that have the word Internet in their name, such as Internet Explorer. The Show pop-up menu filters processes based on the owner. You can change the setting to show only processes owned by your account (User Processes), the system (Administrator Processes), or NetBoot. (NetBoot processes are not likely to be of value on most Mac OS X non-server installations.)
The Process Listing is not, as you might first think, a real-time view of the programs running on the system. The process information is very dynamic and is always changing. To avoid overwhelming the user with a list that jumps all over the place, the process list is only updated every few seconds. Using the Sample every X seconds option, you can change the rate at which the list is refreshed. The larger the number, the longer you must wait for updates.
Processes are listed based on five columns: Name, User, Status, % CPU, and % Memory. Each column can be sorted by clicking on the column heading. Click the small triangle in the upper-right corner of the process list to reverse the sorting order. Click its name within the listing to select a process. The Process ID and Statistics panels in the Extended view show information about the selected process. Using the basic listing, you can glean the following information about a process:
- Name— The name of the process or application.
- User— The user account which launched the process.
- Status— The status of the process. Most should be running, although users who access the command line can also suspend processes.
- % CPU— The percentage of available CPU time being used by the process.
- % Memory— The percentage of available memory being used by the process.
If you'd like even more information about a process, you can click it within the listing, use the More Info disclosure triangle in the lower right of the window to reveal the Process ID and Statistics tabs. The Process ID tab displays the following information:
- Process ID— Each process on a Unix system is given a unique identifier called the Process ID (PID); this number can be used to interact with or terminate the process.
- Parent Process ID— The process that started the selected process. For example, if a user starts a program from the command line (the "shell"), the ID of the shell is listed as the program's parent process ID. Processes started at boot time list the parent process ID of 1 (init).
- Process Group ID— The group ID that was used to launch the process.
- Saved User ID— The user ID that launched the process.
- Terminal— The controlling terminal. If the program was launched from a login session or terminal prompt, it will have a controlling terminal that is used for I/O with the process.
Clicking the Statistics tab shows data on how the process has been behaving on your system. Information about CPU usage and memory usage is readily available:
- Total CPU Time— The total amount of CPU time used by the process—measured in minutes, seconds, and hundredths of a second. Because a process does not get 100% of the CPU 100% of the time, this is not an indication of when the program started. It is the cumulative amount of time used over the entire lifetime of the process, which could span seconds, days, or months, and still hardly make a dent in used CPU time!
- Virtual Memory Size— The amount of virtual memory being used by the selected process.
- Resident Memory Size— The amount of real memory being used.
Menus
The Process Viewer's menus provide a bit more control over the application, such as exporting the current process list to an XML file and sorting the output list.
Use the File menu options to print or export the list of processes. These options can be useful for creating a record of normal system activity to refer to if you think your system is misbehaving:
- Export (Command+E)— Exports the current list of processes as an XML file that can be viewed with Apple's XML editor (included with the Developer tools). Learn more about XML's role in Mac OS X in Chapter 16, "Command-Line Software Installation."
- Print (Command+P)— Prints the process list. Only the processes in the visible portion of the window are printed!
- Quit Process (Shift+Command+Q)— Quits the selected process or processes. If you are not the owner of the process, the system will forbid you from quitting. In addition, quitting some processes will log you out of the system. This is identical to using the Unix kill command.
The Edit menu contains several options, but almost all are grayed out. The Show All Columns (Shift+Command+A) selection has little use other than enlarging the columns to fit the screen if they are accidentally resized. The Sort on Column (Shift+Command+S) function will sort the current column. This is identical to clicking the column heading, but can be useful for resorting with a key press after a new process-listing sample is taken.
Graphic Utilities | Next Section

Account Sign In
View your cart