diagnostic: check if the user is a member of the admin group.

Non-administrative users are unable to run `brew linkapps` (and possibly other
commands) under normal circumstances.
This commit is contained in:
William Woodruff 2016-11-24 12:21:59 -05:00
parent f8aa057b07
commit bb0e683bc4
No known key found for this signature in database
GPG Key ID: 85AE00C504833B3C

View File

@ -1069,6 +1069,19 @@ module Homebrew
message
end
def check_for_member_of_admin_group
groups = Utils.popen_read("groups").split
return unless groups.include?("admin")
<<-EOS.undent
You are not a member of the "admin" group, which will cause
commands like `brew linkapps` to fail.
To fix this, you can run:
`sudo dseditgroup -o edit -a $(whoami) -t user admin`
EOS
end
def all
methods.map(&:to_s).grep(/^check_/)
end