Ask Different is a question and answer site for power users of Apple hardware and software. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How can I list all local user accounts (whether logged in or NOT so 'users' or 'who' is no good) in the terminal on a mac? OS X version is 10.6.8.

I have seen this suggested - dscacheutil -q group

But it lists domain user groups and non-local accounts.

share|improve this question
As a long time AIX user, I sure miss the system management commands they baked into their unix. lsuser would be nice to have for this purpose. – bmike Nov 1 '11 at 14:25
up vote 37 down vote accepted

How about

dscacheutil -q user | grep -A 3 -B 2 -e uid:\ 5'[0-9][0-9]'
share|improve this answer
I like this option. It returns a bunch of accounts beginning with an underscore, though. Any way to filter this out? e.g. _softwareupdate, _mysql – codecowboy Nov 1 '11 at 14:13
Pipe the result through grep dscl . list /Users | grep -v ^_.* – Mark Nov 1 '11 at 14:20
Very cool! I'll have to remember this one. – daviesgeek Nov 9 '11 at 21:58
This is such an easy one to commit to memory, too. – Kelly Jul 26 '13 at 22:58

Try this one. I used it to find lost hidden account.

dscl . list /Users | grep -v '^_'
share|improve this answer
That's precisely what @Mark said here. – Emil Feb 9 '13 at 12:36
what is the point of hidden accounts? – SuperUberDuper Jul 19 at 13:09

User accounts since 10.6 are being managed by OpenDirectory. The backend files related to users for OpenDirectory are here:


Executing ls * in this directory will enumerate all local users registered on the system. Executing plutil -p <file>.plist will allow you to read some properties for specified user account (i.e. current home directory path).

This is rather undocumented so I accept downvotes. However, this method can be used to inspect a system which is not running, and for which the user has only an offline disk image.

share|improve this answer

dscacheutil returns more than just local users, for example any users I've queried Directory Services for also show.

I have found this more useful:

dscl . list /Users | grep -v "^_"

Although it also returns the likes of daemon, nobody and root.

share|improve this answer

If no user home directories were moved then ls /users will do. Except it will also list directories like 'Shared'.

share|improve this answer
Never do this. There are much more than just Shared that can be there. – hamstergene Oct 25 '14 at 13:09

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.