Mac OS X Hacks
Authors: Dornfest R. Hemenway K.
Published year: 2006
Pages: 31-32/161
Buy this book on amazon.com >>

Hack 13 Getting a Glimpse of the Boot Process

figs/beginner.gif figs/hack13.gif

A lot goes on behind the scenes whenever you restart your Macintosh; verbose booting provides a unique glimpse of the Unix underpinnings of Mac OS X.

A lot goes on behind the scenes whenever you restart your Macintosh. In pre-OS X days, we couldn't really tap into this knowledge; at most, we knew what control panels and extensions had been started, but that was about it. Nicely, OS X gives us a few ways we can turn on verbose booting , providing more esoteric knowledge for our coffers.

Being able to see exactly what goes on when you start your computer is easier than you may think. Longtime OS 9 users may recall the Shift or spacebar keyboard tricks: hold one down during bootup and you'll disable, or interactively choose, your extensions, respectively. The same principle lies behind verbose booting in OS X: simply hold down the figs/command.gif and V keys.

When you do this during startup, your screen should turn black and you'll see tiny text instead of the normal happy Mac or Apple logo. Most of this text may not make much sense to you, but some messages about your hardware will appear as OS X tries to figure out what you've got plugged in or installed.

You may find that the text scrolls by too fast for your inquisitive mind to handle. No worries, though; since OS X is based on Unix, nearly everything gets written down. Once you're logged into the Finder, open a Terminal window and enter the following command:

dmesg

This displays the system message buffer and covers everything before the OS X logging daemon boots up (called syslogd , it's common across Unix installations). The output from your dmesg will contain most of the hardware lines I mentioned before, as well as a few other nitpicks here and there; what you see will be unique for your combination of hardware and equipment.

Once the OS X logging daemon comes into play, the rest of your data is saved into /var/log/system.log , the normal place for messages like these. If you open that file up in any text editor (like vi or Emacs), you'll see the output from dmesg (as the buffer is flushed to the system.log ), as well as a few other ConsoleMessage lines — which should be the same as what you'd see right before the OS X login screen (or Finder, if autologin is enabled).

If you want to see the verbose messages for each and every bootup, there's an easier way then holding down the two keys, and that's by modifying your computer's nonvolatile RAM to remember your preference. Enter the following command:

sudo nvram boot-args="-v"

With this, your computer will always restart with verbose booting and will continue to do so until the PRAM is zapped or you boot into OS 9. To stop the verbosity manually, simply leave boot-args empty:

sudo nvram boot-args=""

13.1 See Also

  • For details on dmesg and nvram , at the Terminal [Hack #48], type man dmesg and man nvram , respectively.

  • Booting and Logging In (http://developer.apple.com/techpubs/macosx/Essentials/SystemOverview/BootingLogin/index.html).

Hack 14 Booting from Another Device

figs/beginner.gif figs/hack14.gif

Boot and run your Mac from another device, whether it's an internal hard drive or an external FireWire drive.

I was thrilled to have the chance to try out a seed build or two of Mac OS X 10.2 (Jaguar) before final release. That is, until yet-unnoticed bugs with the Quartz rendering engine turned my screen to mush and compatibility problems with some of my old settings rendered an application all but unusable.

Thank goodness I'd not actually installed the prerelease on my iBook's hard drive, but was running it from an external FireWire hard drive. A quick reboot and I was back to my trusty 10.1.5 partition running on my internal drive.

Macintosh makes it easy to boot from another device. No need to fiddle with a BIOS or horrid boot.ini files. And absolutely no need to unplug one drive to have the Mac recognize and use another.

To boot from another device, make sure it's plugged in, is recognized by Mac OS X, and has a bootable partition containing a usable operating system. Shut down your Mac (Apple menu Shut Down). While holding down the Option key, turn on your Mac. You'll be greeted with the screen shown in Figure 2-1.

Figure 2-1. Booting from another device
figs/xh_0201.gif

I have only one partition listed, despite having an external FireWire drive plugged in; the FireWire drive doesn't have a viable operating system on it at present, so it is excluded from the list of possibilities. Were I to have more than one usable device/operating system, they would be listed alongside Macintosh HD.

Your mouse pointer will probably look like a watch for a time as your Mac scans attached and internal hardware for possible boot devices. You can force a rescan — perhaps after plugging in another device — by clicking the button with the semicircular icon on the left.

When you're ready, choose a device by clicking on it. Macintosh HD, in my case, is already selected. Click the button with the right arrow on the right to boot.

Of course, if you just want to boot from another partition on your local hard drive — you want to pop into Mac OS 9 for a moment, for instance — you should use the Startup Disk preference pane ( Applications System Preferences Startup Disk ). Select the system you wish to boot and click the Restart . . . button, as shown in Figure 2-2.

Figure 2-2. Selecting the Startup Disk
figs/xh_0202.gif
Mac OS X Hacks
Authors: Dornfest R. Hemenway K.
Published year: 2006
Pages: 31-32/161
Buy this book on amazon.com >>