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?
MacOS – How to change the “primary group” for an existing user
groupmacosunixuser-account
Related Question
- MacOS – May I have a list of “System” group names, and their respective gid(s)
- MacOS – Command Line – How to change the order of a user’s group memberships
- MacOS – Understanding the ‘staff’ user group
- MacOS – How to fix a user account screwed up by El Capitan
- Mac – Time Capsule user account password change
- MacOS – Apple network share – how to restrict access for user or staff group
- MacOS – How to remove a user from staff group in macOS
- MacOS – What Is The Relationship between “Users & Groups” and /etc/group
Best Answer
One way to change your group is through the MacOS System Preferences panel. Open it, and then open the Users & 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.
Change user "scott"'s primary id to 20:
This solution is from Richard York's blog post on dscl
Original link dead Oct 15 - now archived