How can I list all local user accounts in Terminal (whether logged in or not?) The commands users or who does not provide this information. OS X version is 10.6.8.

I have seen this suggested command - dscacheutil -q group

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

  • 1
    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, 2011 at 14:25

7 Answers 7


How about

dscacheutil -q user | grep -A 3 -B 2 -e uid:\ 5'[0-9][0-9]'
  • 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, 2011 at 14:13
  • 14
    Pipe the result through grep dscl . list /Users | grep -v ^_.*
    – mmmmmm
    Nov 1, 2011 at 14:20
  • Very cool! I'll have to remember this one.
    – daviesgeek
    Nov 9, 2011 at 21:58
  • 5
    This is such an easy one to commit to memory, too.
    – Kelly
    Jul 26, 2013 at 22:58
  • When I run this on Catalina, even with sudo, I only get myself. dscl . list /Users lists all users. Nov 12, 2020 at 17:55

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

dscl . list /Users | grep -v '^_'
  • 4
    That's precisely what @Mark said here.
    – Emil
    Feb 9, 2013 at 12:36
  • what is the point of hidden accounts? Jul 19, 2016 at 13:09
  • To see uid as well, use dscl . list /Users UniqueID | grep -v '^_' Aug 27, 2017 at 11:10
  • What if the user isn't there?
    – Cameron
    Jan 13, 2019 at 2:54

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.

  • I like it, but it required sudo/root to work, std admin user got a permission error. dscl works for std admin.
    – JL Peyret
    May 12, 2017 at 20:49
  • Thank you, I'm struggling to reset a password for a colleague and every guide/instruction online is showing the old method which no longer works... I was even questioning if the user was corrupt or just missing... however, this has shown the user is there. I've been searching for over an hour and this has got me a little closer but nearly every site in Google is showing outdated info.
    – wilhil
    Jan 27, 2021 at 13:47
  • 1
    All that's in that directory are plist files. Using ls * is not necessary, ls on its own suffices. Since the directory is not accessible by users other than root , sudo ls /var/db/dslocal/nodes/Default/users/* will fail because the file globbing is done before the sudo command, while sudo ls /var/db/dslocal/nodes/Default/users will succeed. Nov 2, 2022 at 17:50
  • @ElhemEnohpi You're right, I've removed the * from the answer, as it indeed had no point :)
    – antekone
    Nov 3, 2022 at 11:04
  • Even as root, Operation not permitted.
    – Devon
    Dec 17, 2022 at 17:43

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.


JMTCW to recreate a command line friendly /etc/passwd equivalent (though not quite in the same order):

dscacheutil -q user |
    paste -d " "  - - - - - - - - |
    sed 's/^name: //;s/ [^[:space:]]*: /:/g'

Or if you prefer a space separated output (but parsing GECOS field will be a little more complicated:

dscacheutil -q user |
    cut -d: -f2 |\
    paste -d " "  - - - - - - - -

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

  • 3
    Never do this. There are much more than just Shared that can be there. Oct 25, 2014 at 13:09

You can also type:

who which tells you who's logged on, and where they're coming from. Useful if you're looking for someone who's actually physically in the same building as you, or in some other particular location.

w which tells you who's logged in, and what they're doing. Especially useful: the 'idle' part. This allows you to see whether they're actually sitting there typing away at their keyboards right at the moment.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .