Although you can perform most system configuration through the System Preferences program, the defaults command lets you poke around under the hood. You can get even further under the hood with the nvram command (perhaps further than most people would need or want to get).
When you customize your Mac using the System Preferences, all of those changes and settings are stored in what's known as the defaults system. Everything that you've done to make your Mac your own is stored as XML data in the form of a property list (or plist). This property list is, in turn, stored in ~/Library/Preferences.
Every time you change one of those settings, that particular property list is updated. For the initiated, there are two other ways to alter the property lists. The first is by using the PropertyListEditor application (/Developer/Applications) and the other is by using the defaults command in the Terminal. Whether you use System Preferences, PropertyListEditor, or the defaults command, any changes you make affect the current user.
defaults [-currentHost | -host name] command
defaults read com.apple.dock orientation.
A value may take one of the following forms:
WARNING: Using the defaults command is not for the foolhardy. If you manage to mangle your settings, the easiest way to correct the problem is to go back to that application's Preferences pane and reset your preferences. In some cases, you can use defaults delete, which will be reset to the same defaults when you next log in. Since the defaults command affects only the current user, you could also create a user just for testing random defaults tips you pick up on the Internet.
% defaults domains
This will print a listing of all of the domains in the user's defaults system. The list you'll see is run together with spaces in between--not quite the prettiest way to view the information.
% defaults read com.apple.Terminal
This command reads the settings from the com.apple.Terminal.plist file, found in ~/Library/Preferences. This listing is rather long, so you might want to pipe the output to less or more to view the contents one screen at a time:
% defaults read com.apple.Terminal | more
% defaults write com.apple.Dock orientation top
This moves the Dock to the top of the screen underneath the menu bar. After changing that setting, you'll need to logout from the system and then log back in to see the Dock under the menu bar.
The nvram utility modifies Open Firmware variables, which control the boot-time behavior of your Macintosh. To list all Open Firmware variables, use nvram -p. The Apple Open Firmware page is http://bananajr6000.apple.com/.
To change a variable, you must run nvram as root or as the superuser. To set a variable, use variable=value. For example, to configure Mac OS X to boot verbosely, use nvram boot-args=-v. (Booting into Mac OS 9 or earlier will reset this.) Table 8-7 lists Open Firmware variables. Some variables use the Open Firmware Device Tree notation (see the technotes available at the Apple Open Firmware page).
WARNING: Be careful changing the nvram utility, since incorrect settings can turn a G4 iMac into a $2000 doorstop. If you render your computer unbootable, you can reset Open Firmware by zapping the PRAM. To zap the PRAM, hold down Option--P-R as you start the computer, and then release the keys when you hear a second startup chime. (If your two hands are busy holding down the other buttons and you have trouble reaching the power button, remember that you can press it with your nose.)
Variable |
Description |
---|---|
auto-boot? |
The automatic boot settings. If true (the default), Open Firmware will automatically boot an operating system. If false, the process will stop at the Open Firmware prompt. Be careful using this with Old World (unsupported) machines and third-party graphics adapters, since the display and keyboard may not be initialized until the operating system starts (in which case, you will not have access to Open Firmware). |
boot-args |
The arguments that are passed to the boot loader. |
boot-command |
The command that starts the boot process. The default is mac-boot, an Open Firmware command that examines the boot-device for a Mac OS startup. |
boot-device |
The device to boot from. The syntax is device:[partition],path:filename, and a common default is hd:,\\:tbxi. In the path, \\ is an abbreviation for /System/Library/CoreServices, and tbxi is the file type of the BootX boot loader. (Run /Developer/Tools/GetFileInfo on BootX to see its type.) |
boot-file |
The name of the boot loader. (This is often blank, since boot-command and boot-device are usually all that are needed.) |
boot-screen |
The image to display on the boot screen. |
boot-script |
A variable that can contain an Open Firmware boot script. |
console-screen |
A variable that specifies the console output device, using an Open Firmware Device Tree name. |
default-client-ip |
An IP address for diskless booting. |
default-gateway-ip |
A gateway address for diskless booting. |
default-mac-address? |
Description not available at time of writing; see errata page at http://www.oreilly.com/catalog/mosxgeeks. |
default-router-ip |
A router address for diskless booting. |
default-server-ip |
An IP address for diskless booting. |
default-subnet-mask |
A default subnet mask for diskless booting. |
diag-device |
A private variable; not usable for security reasons. |
diag-file |
A private variable; not usable for security reasons. |
diag-switch? |
A private variable; not usable for security reasons. |
fcode-debug? |
A variable that determines whether the Open Firmware Forth interpreter will display extra debugging information. |
input-device |
The input device to use for the Open Firmware console. |
input-device-1 |
A secondary input device (so you can have a screen and serial console at the same time). Use scca for the first serial port. |
little-endian? |
The CPU endian-ness. If true, initializes the PowerPC chip as little-endian. The default is false. |
load-base |
A private variable; not usable for security reasons. |
mouse-device |
The mouse device using an Open Firmware Device Tree name. |
nvramrc |
A sequence of commands to execute at boot time (if use-nvramc? is set to true). |
oem-banner |
A custom banner to display at boot time. |
oem-banner? |
The oem banner settings. Set to true to enable the oem banner. The default is false. |
oem-logo |
A 64-by-64 bit array containing a custom black-and-white logo to display at boot time. This should be specified in hex. |
oem-logo? |
The oem logo settings. Set to true to enable the oem logo. The default is false. |
output-device |
The device to use as the system console. The default is screen. |
output-device-1 |
A secondary output device (so you can have everything go to both the screen and a serial console). Use scca for the first serial port. |
pci-probe-mask |
A private variable; not usable for security reasons. |
ram-size |
The amount of RAM currently installed. For example, 256 MB is shown as 0x10000000. |
real-base |
The starting physical address that is available to Open Firmware. |
real-mode? |
The address translation settings. If true, Open Firmware will use real-mode address translation. Otherwise, it uses virtual-mode address translation. |
real-size |
The size of the physical address space available to Open Firmware. |
screen-#columns |
The number of columns for the system console. |
screen-#rows |
The number of rows for the system console. |
scroll-lock |
Set by page checking output words to prevent Open Firmware text from scrolling off the top of the screen. |
selftest-#megs |
The number of MB of RAM to test at boot time. The default is 0. |
use-generic? |
The device node naming settings. Specifies whether to use generic device node names such as 'screen', as opposed to Apple hardware code names. |
use-nvramrc? |
The command settings. If this is true, Open Firmware uses the commands in nvramrc at boot time. |
virt-base |
The starting virtual address that is available to Open Firmware. |
virt-size |
The size of the virtual address space available to Open Firmware. |
Copyright © 2003 O'Reilly & Associates. All rights reserved.