How do I change the "primary group" for an existing user? My current primary group (the gid I see listed by id) is me, rather than staff. I'd like to change it to staff, without changing anything else about my user account. How do I change the "primary group" (PrimaryGroupID) for my account?
One way to change your group is through the MacOS System Preferences panel. Open it, and then open the Users &amp; Groups panel. Unlock the lock icon in the bottom-left so that you can enter your password and make changes.

Once the panel is unlocked, you can right-click (or option-click) on the user you want to change and select Advanced Options from the popup-menu. The advanced options panel will let you specify your default group.

To change the primary group from the command line, first get the ID number of the group and then set the primary group id to that value:

Get a list of groups. You may want to pipe this through less.

# dscacheutil -q group


Change user "scott"'s primary id to 20:

# dscl . -create /Users/scott PrimaryGroupID 20


This solution is from Richard York's blog post on dscl
Original link dead Oct 15 - now archived