15.3 System Configuration

Although you can perform most system configuration through the System Preferences program, the scutil and defaults commands let 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).

15.3.1 scutil

Mac OS X stores network configuration in a database called the dynamic store. You can get at this database using scutil , the system configuration utility. Before you can do anything, you must connect to the configuration daemon ( configd ) with the open command ( close the session with the close command, and exit scutil with quit ):

 Chez-Jepstone:~ bjepson$  sudo scutil  Password:  ********  >  open  

List the contents (a collection of keys) of the configuration database with the list command. The following shows abbreviated output from this command:

 >  list  subKey [0] = DirectoryService:PID   subKey [1] = Plugin:IPConfiguration   subKey [2] = Setup:   subKey [3] = Setup:/   subKey [4] = Setup:/Network/Global/IPv4   subKey [5] = Setup:/Network/HostNames   subKey [6] = Setup:/Network/Service/0   subKey [7] = Setup:/Network/Service/0/Ethernet   subKey [8] = Setup:/Network/Service/0/IPv4   subKey [9] = Setup:/Network/Service/0/IPv6   subKey [10] = Setup:/Network/Service/0/Interface   subKey [11] = Setup:/Network/Service/0/Proxies 

You can show the contents of a key with the show command. The contents of a key are stored as a dictionary (key/value pairs). For example, here are the default proxy settings for built-in Ethernet on Mac OS X (use show Setup:/Network/Service/0/Interface to verify that Service shows a UserDefinedName of Built-in Ethernet ):

 >  show Setup:/Network/Service/0/Proxies  <dictionary> {   RTSPEnable : 0   HTTPSEnable : 0   SOCKSEnable : 0   FTPPassive : 1   GopherEnable : 0 } 

Here are the proxy settings for a Mac OS X machine that's been configured to use a proxy server:

 >  show Setup:/Network/Service/0/Proxies  <dictionary> {   RTSPEnable : 0   HTTPSEnable : 0   SOCKSEnable : 0   FTPPassive : 1   GopherEnable : 0   HTTPPort : 8080   HTTPProxy :   HTTPEnable : 1 } 

To change an entry, lock the database, initialize an empty dictionary entry with d.init , and get the current values of the key you want to change:

 >  lock  >  d.init  >  get Setup:/Network/Service/0/Proxies  

Make your changes to the dictionary, then check them with d.show :

 >  d.add HTTPPort 8888  >  d.add HTTPProxy proxy.nowhere.oreilly.com  >  d.add HTTPEnable 1  >  d.show  <dictionary> {   FTPPassive : 1   HTTPPort : 8888   HTTPEnable : 1   RTSPEnable : 0   HTTPProxy : proxy.nowhere.oreilly.com   GopherEnable : 0   HTTPSEnable : 0   SOCKSEnable : 0 } 

If you are happy with the dictionary values, set the key (this copies the dictionary into the specified key), unlock the database, and examine the key:

 >  set Setup:/Network/Service/0/Proxies  >  unlock  >  show Setup:/Network/Service/0/Proxies  <dictionary> {   RTSPEnable : 0   HTTPSEnable : 0   SOCKSEnable : 0   FTPPassive : 1   GopherEnable : 0   HTTPPort : 8888   HTTPProxy : proxy.nowhere.oreilly.com   HTTPEnable : 1 } 

Be careful while the database is locked. If you try to do something seemingly innocuous , such as switching network location, you could cause the system to behave erratically. It's best to get in and out of the database as quickly as possible.

15.3.2 defaults

When you customize your Mac using the System Preferences, most of those changes and settings are stored in what's known as the defaults system. Nearly 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 Property List Editor application ( /Developer/Applications/Utilities ) and the other is by using the defaults command in the Terminal. Whether you use System Preferences, Property List Editor, or the defaults command, any changes you make affect the current user .

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.

Here are some examples of what you can do with the defaults command. For more information, see the manpage :

View all of the user defaults on your system
 $  defaults domains  

This command prints 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.

View the settings for your Terminal
 $  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  

Change your Dock's default location to the top of the screen
 $  defaults write com.apple.Dock orientation top  

This command moves the Dock to the top of the screen underneath the menu bar. After changing this setting, you'll need to logout from the system and then log back in to see the Dock under the menu bar.

15.3.3 nvram

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 variable.) Table 15-7 lists Open Firmware variables. Some variables use the Open Firmware Device Tree notation (see the technotes available at the Apple Open Firmware page).

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-c-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.)

Table 15-7. nvram variables




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).


The arguments that are passed to the boot loader.


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.


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.)


The name of the boot loader. (This is often blank, since boot-command and boot-device are usually all that are needed.)


The image to display on the boot screen.


A variable that can contain an Open Firmware boot script.


Description unavailable at time of printing. Please see the errata at http://www.oreilly.com/catalog/mpantherunix/.


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 unavailable at time of printing. Please see the errata at http://www.oreilly.com/catalog/mpantherunix/.

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.


A private variable; not usable for security reasons.


A private variable; not usable for security reasons.


A private variable; not usable for security reasons.


A variable that determines whether the Open Firmware Forth interpreter will display extra debugging information.


The input device to use for the Open Firmware console.


A secondary input device (so you can have a screen and serial console at the same time). Use scca for the first serial port.


The CPU endianness. If true , initializes the PowerPC chip as little endian. The default is false .


A private variable; not usable for security reasons.


The mouse device using an Open Firmware Device Tree name.


A sequence of commands to execute at boot time (if use-nvramc? is set to true ).


A custom banner to display at boot time.


The oem banner settings. Set to true to enable the oem banner. The default is false .


A 64-by-64 bit array containing a custom black-and-white logo to display at boot time. This should be specified in hex.


The oem logo settings. Set to true to enable the oem logo. The default is false .


The device to use as the system console. The default is screen .


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.


A private variable; not usable for security reasons.


The amount of RAM currently installed. For example, 256 MB is shown as 0x10000000 .


The starting physical address that is available to Open Firmware.


The address translation settings. If true , Open Firmware will use real-mode address translation. Otherwise, it uses virtual-mode address translation.


The size of the physical address space available to Open Firmware.

screen-# columns

The number of columns for the system console.


The number of rows for the system console.


Set by page checking output words to prevent Open Firmware text from scrolling off the top of the screen.


The number of MB of RAM to test at boot time. The default is .


The device node naming settings. Specifies whether to use generic device node names such as `screen', as opposed to Apple hardware code names .


The command settings. If this is true , Open Firmware uses the commands in nvramrc at boot time.


The starting virtual address that is available to Open Firmware.


The size of the virtual address space available to Open Firmware .

Mac OS X Panther for Unix Geeks
Mac OS X Panther for Unix Geeks
ISBN: 0596006071
EAN: 2147483647
Year: 2003
Pages: 212

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