Advertisement

Mac 101: What's happening when your Mac is starting up?

Recently, in the interest of sleeping soundly through the night, I've been turning off my 27" iMac every night. No, I'm not doing this for energy conservation, but the darned thing used to light up at random intervals in the middle of the night. Since I now have to power up the iMac every morning, I see the bootup process regularly.

You know how it goes. First you hear the startup chime, then you see that gray screen, then the gray screen with the Apple logo and spinning gear on it, then a light blue screen, and finally a login window or the desktop appears. What's actually going on while all of this is showing up on your screen? Well, as those of us who have gone through the training and tests to become Apple Certified Support Professionals are aware, each of those visual cues is an indication that a milestone in the bootup process has been reached.

Follow along as I take you on a tour behind the scenes of the Mac OS X boot process, starting on the next page.

The Startup Chime: When you press the power button on your Mac, the first thing that happens is the Mac's hardware is initialized and the firmware -- BootROM -- is loaded and run. The BootROM is stored on flash memory chips on your Mac's motherboard, and it works as a miniature operating system to get things started before Mac OS X is loaded.

At power on, the firmware runs the Power-On Self Test (POST), which tests the processors, system memory, and network (Wi-Fi, Ethernet) and peripheral (USB, FireWire, Bluetooth) interfaces. If your hardware passes the POST, the startup chime is sounded and a light gray background is displayed on any attached display.

So what happens if your Mac doesn't pass the test? The display(s) either remain blank or off, or you might see error codes displayed. It varies from Mac to Mac, but error codes can be audible tones ("The Chimes of Doom"), flashes from external or internal lights, or a combination of those items. It doesn't take an Apple Genius to know that when your machine doesn't boot, you ought to take it to your AASP (Apple Authorized Support Provider) ASAP!

If life is good to you and your Mac did pass the POST, the firmware then goes on to find the booter file.

The Gray Screen and The Apple Logo: The firmware knows where the system booter file is, since it saves the location in nonvolatile RAM (NVRAM). The choice of booter file can be specified in either System Preferences > Startup Disk or the Boot Camp control panel in Windows. When the booter file is found, EFI (Extensible Firmware Interface) starts the booter process to load Mac OS X or Windows if you're using Boot Camp on a Mac. When booting into Mac OS X, that friendly dark gray Apple logo is displayed. What if the firmware can't find a booter file? That's when you see that folder icon with a question mark in it.

There are, of course, some keyboard modifiers for startup that we're (hopefully) all familiar with. Since some of these modifiers can change which booter file is loaded, these keys must be pressed while you're powering up or rebooting. As a refresher, here are a few of the more notable modifier keys:

  • C -- to start up from a bootable DVD or CD in the optical drive

  • T -- to start up a Mac with FireWire in Target Disk Mode. This is a great way to access an older Mac's hard disk when using the Migration Assistant utility to move data and settings to a new Mac.

  • Option -- this starts the Mac in the Startup Manager, which lets you select which volume to start up from. This is very useful with Boot Camp. This setting isn't stored in NVRAM, so it doesn't persist between startups.

  • Shift -- this starts Mac OS X in Safe Mode. A Safe Boot is performed, and the system not only tests startup processes more carefully, it also limits auto-launched processes to a bare minimum.

  • Command - V -- now we're starting up Mac OS X in Verbose Mode. In Verbose Mode, you actually get to see what's going on in Unix during startup. Instead of the light gray and blue screens, you see a black screen with white text on it.

  • Command-Option-P-R -- this resets NVRAM settings and then restarts the Mac. The "PR" comes from the term "Parameter RAM."

There are more modifiers, but that should give you a taste of what's available without getting into possibly dangerous territory.

The Spinning Gear: The booter process is started by the Mac firmware and it does two things. It loads the Mac OS X kernel, and it loads kernel extensions (KEXTs) so the kernel is able to take over the system and continue startup. When the booter successfully loads the kernel, you'll see the dark gray spinning gear icon below the Apple Logo. After this point, the gear spins while launchd, the parent process for every process that runs on the Mac, is started and other processes are spawned.

The Blue Screen of Happiness: On a Window-based system, a blue screen has always been a cause for cussing, but on Mac OS X, it means that the system initialization process is taking place. When the bright blue screen appears, that means that the launchd process has spawned the very important WindowServer process. That process draws the Mac OS X user interface, hence its importance to what is going on during bootup.

After this point, good old launchd fires off loginwindow.app (which is both a background process and an application), and either displays the login window or speeds directly to the user's desktop.

The End of the Tour: So that is what is going on while your Mac is booting up. One of my favorite things to do to amaze Mac newbies is to show them the "Verbose Mode" startup described above. When they see the list of things happening behind the scenes on their Mac, they get a better understanding of some of the complex processes that Apple does such a good job of hiding in Mac OS X.