Apple’s macOS is full of useful macOS specific command-line tools which can make your life a lot easier once you get to know them. Below are a few of the tools I use.
It should go without saying, read their respective manpages to get an understanding of what they do, which options and switches they take and, get a feel for how they can ruin your OS and day if you get it wrong.
| command | description |
|---|---|
| caffeinate | Prevent the system from sleeping on behalf of a utility |
| defaults | Read and write user defaults |
| dscacheutil | Gather information, statistics and initiate queries to the Directory Service cache |
| fs_usage | Filesystem usage (process/pathname) |
| iosnoop | Snoop I/O events as they occur |
| launchctl | Interfaces with launchd |
| open | Open files and directories |
| pbcopy | Copy data to pasteboard (clipboard) |
| pbpaste | Paste data from the pasteboard (clipboard) |
| powermetrics | Gathers and display CPU & power usage statistics |
| sw_vers | Print macOS version information |
| sysctl | Get or set kernel state |
| tmutil | Time Machine utility |
| xcode-select | Manages the active developer directory for Xcode and BSD tools |