Often when troubleshooting systems, you might wish to boot into Safe Mode to run in a minimized boot environment to test if a third-party extension or add-on is causing problems with your machine. In addition, booting to Safe Mode also runs some cleaning and maintenance routines on your system, which can help iron out problems.
Most people know about using the keyboard to boot to Safe Mode, by pressing the Shift key down after hearing the boot chimes, and holding it until you see the grey Apple icon with the spinning indicator below it. You may also see a progress bar on systems running Snow Leopard.
While using the keyboard is the most common method of invoking Safe Mode, all this does is send a boot instruction (argument) to the kernel so the kernel will load in an alternate manner from its default settings. Besides using the keyboard this can be done by running the "nvram" command in the Terminal, which can be useful in situations where the keyboard is broken or you do not have access to it (as in the case of servers), or you would like to have the system always boot in an alternate boot mode.
To set the boot arguments using the "nvram" command, open the Terminal utility when logged in as administrator and run the following command:
sudo nvram boot-args="-x"
After this command is set, the boot argument "-x" will be sent to the kernel each time the system loads, which will boot it into Safe Mode. You can also set the system to boot into verbose mode and single-user mode by using the "-v" and "-s" flags instead of the "-x" flag. If you would like to use two of these modes then you can also specify multiple flags. For instance, if you want to boot into Safe Mode but also see what is happening during boot, you can use the nvram command and set the boot argument flags to be "-x -v".
After the boot commands are set, restart the computer and the system should now load into the alternate boot option each time the computer is started. To clear the setting, run the following command, which will clear the boot argument list and have the kernel load its default settings:
sudo nvram boot-args=""
A final way to clear these settings is to reset the system's PRAM. To do this, restart the system and immediately hold the Option-Command-P-R keys all at once. Allow the system to reset a couple of times while these keys are held, and then release the keys and allow the system to boot normally. Resetting the PRAM will work, but it will also reset other PRAM settings such as the default volume level. These settings can easily be reapplied, but it may be a little more cumbersome than running the terminal command above.