Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

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?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

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

share|improve this answer
    
Where it says just "Group"? Is there a way to do it from the command line? –  raxacoricofallapatorius 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? –  raxacoricofallapatorius 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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.