chgrp in Mac OS X

By: Strauss K  

Change group ownership (update the group ID of files.)

      chgrp [-fhv] [-R [-H | -L | -P]] group file ...

The group operand can be either a group name, or a numeric group ID.


   -R     Recurse: Change the mode of file hierarchies rooted in the files
          instead of just the files themselves.

   -R -H  Follow symbolic links on the command line
          (by default Symbolic links within the tree are not followed.)	       

   -R -L  All symbolic links are followed.

   -R -P  No symbolic links are followed. (default)

   -f     Force, ignores errors, except for usage errors and doesn't query
          about strange modes (unless the user lacks permissions).

   -h     If the file is a symbolic link, the group ID of the link itself
          is changed rather than the file that is pointed to.

   -v     Verbose, show filenames as the group is modified.

The user invoking chgrp must belong to the specified group and be the owner of the file, or be the super-user.


The chgrp utility exits 0 on success, and >0 if an error occurs.

In previous versions of this system, symbolic links did not have groups.
The -v option is non-standard and its use in scripts is not recommended.


Assign Ursula as the owner of "MyFile.txt" file in the Shared directory.

sudo chown Ursula /Users/Shared/MyFile.txt

Assign Ursula as the owner, and staff as the group for everything in the "tmp" folder

sudo chown -R Ursula:staff /Users/Shared/tmp/

Archived Comments

Most Viewed Articles (in macos )

Latest Articles (in macos)

Comment on this tutorial