Book HomeMac OS X for Unix GeeksSearch this book

Chapter 2. Startup

The most striking difference between Mac OS X and other flavors of Unix is in how Mac OS X handles the boot process. Gone are /etc/inittab, /etc/init.d, and /etc/rc.local from traditional Unix systems. In their place is a BSD-like startup sequence sandwiched between a Mach[5] foundation and the Aqua user interface.

[5]Mach is a microkernel operating system developed at Carnegie Mellon University. The Mac OS X kernel, xnu, is a hybrid of Mach and BSD.

This chapter describes the Mac OS X startup sequence, beginning with the BootX loader and progressing to full multiuser mode, at which time the system is ready to accept logins from normal users. The chapter also covers custom startup items, network interface configuration, and Mac OS X's default cron jobs.

2.1. Booting Mac OS X

When the computer is powered up, the firmware is in complete control. After the firmware initializes the hardware, it hands off control to the BootX loader, which bootstraps the kernel. After a trip into Mach, the control bubbles up into the BSD subsystem, and eventually into the Aqua user interface.

By default, Mac OS X boots graphically. If you'd like to see console messages as you boot, hold down Figure -V as you start the computer. To boot in single-user mode, hold down Figure -S as you start the computer.

2.1.3. The rc Scripts

The init process launches the /etc/rc.boot and /etc/rc shell scripts to start the system. Both rc scripts (and all startup items) source the /etc/rc.common script, which sets the initial environment, defines some useful functions, and loads the /etc/hostconfig file. /etc/hostconfig controls which system services need to be started and defines such things as the AppleTalk hostname. Example 2-2 is an excerpt from the hostconfig file.

Example 2-2. A portion of /etc/hostconfig


This excerpt shows that sshd and httpd will be started on "Brian Jepson's Computer" (the decoded AppleTalk hostname) at startup. The AppleTalk hostname is encoded as a sequence of hexadecimal bytes (for example, 42=B, 72=r, 69=i, 61=a, and 6e=n).

After rc.boot has loaded in values from /etc/rc.common, it determines whether the system is booting from a CD. Next, rc.boot tests to see whether the system is booting in single-user mode. If the system is neither in single-user mode nor booting from a CD, then rc.boot performs a check of the filesystem (fsck). If the fsck fails, then rc.boot tries an fsck -y, which assumes a "Yes" answer to all the questions that fsck asks. If that fails, the system reboots (and may end up trying an fsck -y over and over again).

TIP: If you find yourself in an fsck loop, you should boot from the Mac OS X installation CD. You can boot from a CD by holding down the C key at startup. When the Installer appears, choose Disk Utility from the Installer menu and use it to inspect and repair the damaged disk.

If rc.boot succeeds, init drops into a shell (for single-user mode) or launches /etc/rc (for installation or multiuser mode). In single-user mode, only the root user may log in. In multiuser mode, the system is fully functional and ready to accept logins from normal users.

If /etc/rc determines that the system is booting from a CD, it starts the Mac OS X installation program. (If you booted from a CD in single-user mode, you'll get dropped into a shell and /etc/rc won't get run.) Otherwise, /etc/rc mounts local filesystems and starts kextd, the kernel extension daemon. After that, it starts the Window Server and the update process (which flushes the filesystem buffers every 30 seconds). Finally, /etc/rc enables the swap file, sets the language for the system, and hands off control to /sbin/SystemStarter.

What Is kextd?

The kernel boots with the minimum set of extensions needed to mount the root filesystem on all supported hardware. Some of these extensions are not needed, so /etc/rc starts the kextd daemon (/usr/libexec/kextd) to unload unnecessary extensions. For example, the iPodDriver includes the OSBundleRequired key to support booting from your iPod. If you don't have your iPod plugged in, kextd can safely unload that driver. The kextd daemon is also responsible for loading and unloading extensions for the duration of the system's uptime.

2.1.4. SystemStarter

SystemStarter examines /System/Library/StartupItems and /Library/StartupItems for applications that should be started at boot time. /Library/StartupItems contains items for locally installed applications; you can also put your own custom startup items there. /System/Library/StartupItems contains items for the system. You should not modify these or add your own items here. Table 2-1 lists Mac OS X's available startup items.

Table 2-1. Mac OS X default startup items




Starts the acct daemon, which collects process accounting records.


Starts the Apache web server. Enable this with the WEBSERVER entry in /etc/hostconfig or by turning on Web Sharing (System Preferences Figure Sharing).


Starts the desktop database, input managers, and printing services.


Starts Apple file sharing. Enable this with the AFPSERVER entry in /etc/hostconfig or by turning on File Sharing (System Preferences Figure Sharing).


Starts the AppleTalk protocol. Enable this with the APPLETALK entry in /etc/hostconfig.


Starts the authentication server. Enable this with the AUTHSERVER entry in /etc/hostconfig.


Starts named, the Internet domain name server, if DNSSERVER is set to -YES- in /etc/hostconfig.


An empty startup script that maintains compatibility with earlier versions of Mac OS X, where this script was used to configure the network.


Starts the font and window server.


Enables automatic crash report generation when an application crashes. Enable this with the CRASHREPORTER entry in /etc/hostconfig or by selecting Log crash information in the Crashes panel of the Console application's Preferences (the Console application is located in /Applications/Utilities).


Starts the cron daemon.


Starts lookupd, a daemon through which Directory Services is accessed.


Mounts local filesystems.


Functions as a special startup routine used by headless servers, such as the XServe. Mac OS X Server only.


Sets up IP Aliasing (assigns multiple IP addresses to single physical adapter). Mac OS X Server only. Enable this with the IPALIASES entry in /etc/hostconfig. See the IPAliases(5) manpage.


Starts a service that allows a server to take over for another server in case it fails. Mac OS X Server only.


Starts inetd and, optionally, the bootp service.


Starts slapd, the standalone LDAP daemon.


Does nothing except to note the point at which the system is ready to display the login window. This is a placeholder service.


Starts the multicast DNS responder, which is used by Rendezvous for configuration.


Functions as a startup script for MySQL. Mac OS X Server only. Enable this with the MYSQL entry in /etc/hostconfig.


Starts the NFS client. The server is also started if NetInfo or /etc/exports has been configured to export one or more filesystems.


Starts the Network Information Service unless NISDOMAIN is set to -NO- in /etc/hostconfig.


Starts NetInfo. If the NETINFOSERVER entry is set to -YES- in /etc/hostconfig, this will start up the nibindd daemon, which will start one or more NetInfo servers. If the entry is set to -AUTOMATIC- (the default), this will not start nibindd and will only start the local NetInfo server.


Configures network interfaces and the hostname. If IPFORWARDING is enabled in /etc/hostconfig, this script also enables IP forwarding.


Loads various networking extensions.


Starts the NTP client. Enable this with the TIMESYNC entry in /etc/hostconfig or with System Preferences Figure Date & Time Figure Network Time.


Starts the portmap daemon. Enable this with the RPCSERVER entry in /etc/hostconfig.


Starts the Common Unix Printing System (CUPS).


Starts the QuickTime Streaming Server. Mac OS X Server only. Enable this with the QTSSERVER entry in /etc/hostconfig.


Starts snmpd, the SNMP daemon. Mac OS X Server only. Enable this with the SNMPSERVER entry in /etc/hostconfig.


Starts sshd. Enable this with the SSHSERVER entry in /etc/hostconfig or by enabling remote login in System Preferences Figure Sharing.


Starts the Samba service, which provides file services to Windows clients.


Starts security services.


Starts sendmail. Enable this with the MAILSERVER entry in /etc/hostconfig.


Supports serial terminals for headless servers. Mac OS X Server only. See the SerialTerminalSupport script for configuration information.


Starts the Server Manager daemon. Mac OS X Server only. Enable this with the SERVERMANAGERSERVER entry in /etc/hostconfig.


Starts syslogd.


Tunes the system based on details of your hardware configuration (such as the amount of installed memory).


Starts the VPN server. Mac OS X Server only. Enable this with the VPNSERVER entry in /etc/hostconfig.


Starts the watchdog service, which monitors and restarts critical services when they quit unexpectedly. See the watchdog(8) manpage. Mac OS X Server only.

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.