diff --git a/bin/brew b/bin/brew index 5fe19cc8966de281879e9fc979dde4cf92f8a75f..b7c5ff98c2e5a2fe7b92978ddae75654f48e1ea5 100755 --- a/bin/brew +++ b/bin/brew @@ -26,6 +26,11 @@ when '-v' end end +if Process.uid.zero? and not File.stat(HOMEBREW_BREW_FILE).uid.zero? + # note we only abort if Homebrew is *not* uninstalled sudo and the user + # calls brew as root. The fix is to chown brew to root. + abort "Cowardly refusing to `sudo brew'" +end case HOMEBREW_PREFIX.to_s when '/', '/usr' # it may work, but I only see pain this route and don't want to support it abort "Cowardly refusing to continue at this prefix: #{HOMEBREW_PREFIX}"