aboutsummaryrefslogtreecommitdiffstats
path: root/Library
diff options
context:
space:
mode:
authorMax Howell2011-08-17 12:30:21 +0100
committerMax Howell2011-08-17 12:30:21 +0100
commit63da621a3fb430cb9ae757a09077890be8aa689e (patch)
tree92aeaaa9180d6ccf3c63f53cd6d71985aff29aaa /Library
parent8e52cfad1b32ef5b9b0107c4361a5863698a19f7 (diff)
downloadhomebrew-63da621a3fb430cb9ae757a09077890be8aa689e.tar.bz2
Only error out for `sudo brew install`
Note this only happens if Homebrew is *not* installed sudo. Which is most of the time true. Fixes #6899
Diffstat (limited to 'Library')
-rw-r--r--Library/Homebrew/cmd/install.rb6
1 files changed, 6 insertions, 0 deletions
diff --git a/Library/Homebrew/cmd/install.rb b/Library/Homebrew/cmd/install.rb
index e31b1b35e..b7f9e7cae 100644
--- a/Library/Homebrew/cmd/install.rb
+++ b/Library/Homebrew/cmd/install.rb
@@ -9,6 +9,12 @@ module Homebrew extend self
raise "No available formula for #{name}\n#{msg}" if msg
end unless ARGV.force?
+ if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero?
+ # note we only abort if Homebrew is *not* installed as sudo and the user
+ # calls brew as root. The fix is to chown brew to root.
+ abort "Cowardly refusing to `sudo brew install'"
+ end
+
install_formulae ARGV.formulae
end