1
1
How would I obtain the Users and Groups listed under System Preferences from a Mac through the terminal?
I've tried
dscl . list /users
dscl . list /groups
But they give me a list of system-ish users as well. I just want the users and groups I would see if I went into System Preferences and viewed them. Any help would be much appreciated. Thanks in advance.
The first one worked, the second line didn't return anything at all not even Admin or Standard User as listed in System Preferences. – John – 2012-10-05T03:51:02.263
The second one is looking for groups, not users; if you haven't created any groups (other than the builtin system ones), it won't list anything. – Gordon Davisson – 2012-10-05T05:56:30.923
Thanks for the help. Is there any specific documentation related to this. You mentioned a quick and dirty version. Is there a better, perhaps shorter, more concise version? – John – 2012-10-06T03:45:04.977
I don't know of any documentation, and I'm not sure what additional complications (i.e. other criteria than ID number) there may be that this doesn't handle. A more complete version wouldn't be shorter, it'd probably be quite a bit longer. – Gordon Davisson – 2012-10-06T04:00:36.410
What would a more complete version do exactly? Thanks for all the information. – John – 2012-10-07T01:56:21.803
I don't know what else a more complete version might need to do; you'd probably need to get a look at the source code for the Users & Groups preference pane to find out exactly what criteria it uses to decide which accounts to show. – Gordon Davisson – 2012-10-07T17:57:55.933
If you have any more useful information related to this, it would be much appreciated. Otherwise, thank you for all the help. – John – 2012-10-07T22:01:18.740
Any idea how one would use this in objective c? I have something that reads commands such as system_profiler with 3 args, but not something that passes something this long. – John – 2012-10-08T00:11:30.423