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

Get Running Mac OS X Tiger now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.