7

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?

10

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.

# 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

| improve this answer | |
  • Where it says just "Group"? Is there a way to do it from the command line? – orome Feb 9 '13 at 4:40
  • Thanks! My old group was rax, which is my user name (both 501). Is there any reason to preserve that by adding myself back as a member of the rax group (though not as primary). Without doing so will I still have access to all files with rax:rax permissions? – orome Feb 9 '13 at 14:51
  • Glad to help. I'd add yourself to that group just in case - no harm in doing so. If you don't add yourself to the group, then you'd run the risk of not being able to access a file. – ScottYoumans Feb 10 '13 at 14:48
  • looks like with this steps there's additional field egid gets added and which still points to staff. is that expected? or is there a way to change that as well – nir Aug 22 '16 at 23:18

You must log in to answer this question.

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