Skip to content
Snippets Groups Projects
Commit e354b70d authored by Max Howell's avatar Max Howell
Browse files

If brew is installed non-root refuse to `sudo brew`

Rationale: people break their installs by mixing sudo and non-sudo usage. They are used to having to `sudo port install` and shit like that, so I understand why the mixing happens.
parent 81c7ec99
No related branches found
No related tags found
No related merge requests found
......@@ -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}"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment