Hack 13 Getting a Glimpse of the Boot Process

figs/beginner.giffigs/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).



Mac OS X Hacks
Mac OS X Hacks: 100 Industrial-Strength Tips & Tricks
ISBN: 0596004605
EAN: 2147483647
Year: 2006
Pages: 161

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net