Skip to content

Maintenance Ruby 3.4 gets fixes, but no new features. Switch to Ruby 4.0 →

class method

Process.groups

() -> ::Array[::Integer]
Process.groups → array

Returns an array of the group IDs in the supplemental group access list for the current process:

Example
Process.groups # => [4, 24, 27, 30, 46, 122, 135, 136, 1000]

These properties of the returned array are system-dependent:

  • Whether (and how) the array is sorted.

  • Whether the array includes effective group IDs.

  • Whether the array includes duplicate group IDs.

  • Whether the array size exceeds the value of Process.maxgroups.

Use this call to get a sorted and unique array:

Example
Process.groups.uniq.sort
See also .groups= .gid= .gid .initgroups also in 4.1 · 4.0 · 3.3 · 3.2 · 3.1 · 3.0