Query Users and Groups with dscl
Read the macOS directory service directly: list accounts, inspect user records, and check group membership.
Run `dscl . -list /Users UniqueID` to list local accounts with UIDs, and `dscl . -read /Users/<name> RealName` for one user's details.
01Command
Command
$ dscl . -list /Users UniqueID02What it does
dscl speaks to Directory Services, so with the '.' source it exposes the local node: /Users, /Groups, and /SharePoints. Numeric UIDs above 500 are normal human accounts, while lower ones are system accounts — handy when auditing who can log in. Group membership is stored in the GroupMembership key, e.g. `dscl . -read /Groups/admin GroupMembership`.
03Risk
!Warning: dscl also writes (create/delete/append) — a mistyped path can damage local account records.
04Undo
✓No undo needed — this command does not change persistent state.
05Sources
- DSCL Command: Directory Service command line utility in macOSEvidence: Documents dscl . -list /Users, -read, -search and group membership queries against the local directory.
Last verified: 2026-09-17 · Category: System & Settings