Query Users and Groups with dscl

Read the macOS directory service directly: list accounts, inspect user records, and check group membership.

macOSusersdscladministrationLow risk
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 UniqueID

02What 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

RiskLow risk
!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

Last verified: 2026-09-17 · Category: System & Settings