Skip to content

Instantly share code, notes, and snippets.

@skull-squadron
Created April 26, 2011 06:13
Show Gist options
  • Save skull-squadron/941862 to your computer and use it in GitHub Desktop.
Save skull-squadron/941862 to your computer and use it in GitHub Desktop.
Find the next free GID / UID on Mac OS X 10.6 snow leopard.
NEXTUID=$(dscl . -list /Users UniqueID | awk 'BEGIN{i=0}{if($2>i)i=$2}END{print i+1}')
NEXTGID=$(dscl . -list /Groups PrimaryGroupID | awk 'BEGIN{i=0}{if($2>i)i=$2}END{print i+1}')
@skull-squadron
Copy link
Author

Add a new group:

sudo dscl . -create /Groups/$GROUPNAME gid $NEXTGID

Credit: http://serverfault.com/questions/131942/how-do-i-add-a-group-in-mac-os-x-10-6

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment