aboutsummaryrefslogtreecommitdiffstats
path: root/Library/Homebrew/diagnostic.rb
diff options
context:
space:
mode:
authorWilliam Woodruff2016-11-24 12:21:59 -0500
committerWilliam Woodruff2016-11-24 12:26:50 -0500
commitbb0e683bc47b50a6f054e7d898728fa84c637a64 (patch)
treec90a6400537a68629757a490143807ff582374e7 /Library/Homebrew/diagnostic.rb
parentf8aa057b07013ad8d86e8db562a96439104693ff (diff)
downloadbrew-bb0e683bc47b50a6f054e7d898728fa84c637a64.tar.bz2
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.
Diffstat (limited to 'Library/Homebrew/diagnostic.rb')
-rw-r--r--Library/Homebrew/diagnostic.rb13
1 files changed, 13 insertions, 0 deletions
diff --git a/Library/Homebrew/diagnostic.rb b/Library/Homebrew/diagnostic.rb
index 19148a6ae..edade67bf 100644
--- a/Library/Homebrew/diagnostic.rb
+++ b/Library/Homebrew/diagnostic.rb
@@ -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