The true beauty of Mac OS X is Darwin, the BSD-based UNIX that runs under the hood of every Mac OS X computer. Having UNIX handy is what attracted me to OS X, and I know plenty of other administrator-types that have followed suit. Every UNIX variant has commands that make using it easier if you know about them. OS X is no different in that regard. Although these command line utilities may not be specific to Mac OS X, they are invaluable tools for system administration.
nicl
/nidump
-- NetInfo database command line utilities. It's probably bad form to start a list of five by cheating and combining multiple utilities into one, but all of the NetInfo database utilities are important. Unlike other UNIX variants, OS X does not store all username and password information in/etc/passwd
and/etc/shadow
. (Technically it does store some information there, but only for booting in single user mode.) The NetInfo utilities are the tools necessary to manipulate user and group information from the command line.softwareupdate
- system software update tool.softwareupdate
is used to apply updates from Apple. This tool is critical in the application of security updates, and can save a system administrator a lot of footwork (or plane rides, as the case may be).hdiutil
- manipulate disk images. Most software for Mac OS X is distributed as disk images (DMG).hdiutil
can be used to mount, detach, and create disk images. It can also be used to burn a disk image to CD/DVD. When installing packages from the command line, this utility is used right before the next one on our list.installer
- system software and package installer tool. This utility installs OS X packages (PKG or MPKG) on a specified volume.ditto
- copy files and directories to a destination directory. That sounds rather boring. In truth,ditto
is an amazing tool. Not only can it duplicate directories (creating the destination directory if necessary), but it can also write to and from CPIO and ZIP archives.
There is one command line utility that really didn't make the top five list, but deserves an honorable mention.
sudo
- execute a command as another user. Since it is open-source software maintained outside of Apple,sudo
is definitely not OS X specific. But, since many system administrators are used to operating as the super-user, it's important to note thatroot
is disabled by default in Mac OS X. (This is not true in the case of Mac OS X Server.) This means that most system administration tasks should be run withsudo
.