JAEN

macOS

dscl

CautionQuery Directory Services

dscl . -list /Users

Reads/edits the local directory — UIDs, hidden users, group data; the low-level account inspector.

Examples

  • dscl . -read /Users/taro UniqueIDRead a user's UID
  • dscl . -list /Users UniqueIDAll users with their UIDs
  • dscl . -read /Groups/admin GroupMembershipMembers of the admin group
  • sudo dscl . -append /Groups/admin GroupMembership taroAdd a user to the admin group

Syntax

dscl . -list /Users / dscl . -read /Users/<name>

Key points

  • Users starting with _ are system accounts. Leave them alone.
  • Regular user UIDs start at 501.
  • It reads and writes the same data as Users & Groups in System Settings.

When it does not work

  • A wrong write can lock a user out. Make sure another admin account exists before changing anything.

Before you run it

Writes can corrupt accounts.

Related commands

The same reference, with no signal at all

Every command on this site, held on your device. The app adds 632 more: 1,510 commands and 120 fix flows, searchable with no connection. Free to install, no ads (some content is a one-time purchase).

Get it free on the App Store