(Or: Mastering startup and login to save time and frustration.)
You've most likely booted up your Mac many, many times; if you've been using OS X for a while, you may have even set up a few applications to launch at login. However, there's a lot more going on during startup and login than you're probably aware. The startup system is chosen, code is loaded, services are started, and the login process is executed. Like much of Mac OS X, each of these actions and processes can be customized. In this chapter, you'll learn more about the startup and login processes, how to tailor them to your preferences and uses, and how to take advantage of special startup options.
When your Mac starts up, you see the gray Apple startup screen, then the white "Mac OS X" window (called the boot panel) on a blue background, and then the login screen. After logging in, you finally see the familiar Mac OS Desktop. (If your Mac is set to auto-login, you never even see the login screen.) However, between the time you hit the power button and when you see the Desktop, a lot of things go on in the background. While it's not vital for you to know these processes inside and out, background on them will be useful later in the chapter as we discuss ways to customize startup. The following is a summary of what happens at startup, in the order the events occur:
BootROM is activated The BootROM is firmware built into your Mac's hardware. Its purpose is to initialize and test your computer's hardware and to choose an operating system to boot into. Assuming you've chosen a Mac OS X volume to boot from, the process proceeds as described below. (Open Firmware, which I'll talk about later in this chapter, is part of the BootROM.)
BootX runs BootX is a utility that loads the core of Mac OS X (the kernel), as well as any kernel extensions (drivers that interact directly with the kernel to provided added functionality; these files are generally located in /System/Library/Extensions). You see the gray Apple image on the screen. BootX then loads the systems for data, I/O (input/output), and messaging, and mounts the file system. At this point your computer is officially "booting" Mac OS X.
System initialization occurs Officially called the "BSN init process," system initialization does four things:
Checks for certain startup options such as single-user mode or CD booting (both discussed later in this chapter)
Runs the system initialization scripts (located at /etc/rc.boot and /etc/rc)
Launches the login window application, which is responsible for displaying the login window and managing user-level processes
Continues to run in the background, cleaning up system-level processes that terminate
The final step of the /etc/rc script is to launch Mac OS X's SystemStarter utility (located at /sbin/SystemStarter). This utility launches the various services that allow Mac OS X to function properly, as well as any services (from both Apple and third-party vendors) that provide additional, system-level functionality. Apple's startup items are located in /System/ Library/StartupItems; third-party vendors generally install their startup services in /Library/StartupItems. (You're probably thinking, "Hey, there's that multi-domain file organization I read about in Chapter 1!" If so, you're correct.) Note that SystemStarter is a Unix utility that cannot be launched in the Finder; if you ever need to use it, you have to use Terminal to access it.
You can get all the gory details of the boot sequence from Apple's official developer note on the topic: http://developer.apple.com/techpubs/macosx/Essentials/SystemOverview/BootingLogin/.
If you've ever opened the Process Viewer utility and seen processes you didn't recognize, this is a big source of them. Most of the things launched by SystemStarter are processes that don't show up anywhere other than Process Viewer or other utilities that reveal system-level processes.
If the above seems a bit complicated and geeky, don't worry. None of it is necessary for you to use, and enjoy using, your Mac. However, later in the chapter I give a few cool tips that deal with the boot process; you'll definitely have a better understanding of the "why" and "how" behind them having read this section. Now it's time to talk about how to customize the process.