O'Reilly logo

Running Mac OS X Tiger by James Duncan Davidson, Jason Deraleau

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Command-Line Open Directory Tools

Mac OS X provides a suite of command-line tools to view and manage the information in Open Directory. The most useful of these tools are:

dscl

A general-purpose interactive command-line tool for working with data in any Open Directory data source, including LDAP, NetInfo, SMB, and Bonjour. This tool can also be used in single-shot mode.

nicl

An interactive command-line tool for working with data in a NetInfo database. Unlike dscl, this tool will not work with any other data source. This tool can also be used in single-shot mode.

nidump

Extracts data from a NetInfo database into either legacy Unix flat file formats (such as the files found in the /etc directory) or into a NetInfo-specific raw format.

niload

Loads data from a flat file, either a Unix /etc format file or a NetInfo raw format file.

niutil

A single-shot tool used for reading and writing information to a NetInfo database. You should consider using nicl in single-shot mode instead of this tool.

nifind

Searches through a NetInfo database for directories that match a pattern.

nigrep

Searches through a NetInfo database for directories or properties that match a particular pattern.

Of these commands, the most useful are dscl, nicl,nidump, and niload.

Backing Up and Restoring a NetInfo Database

Before you get too creative with your NetInfo database, you should make sure you have a good backup of it. You can create a backup simply by copying the /var/db/netinfo/local.nidb directory. For example, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required