If homebrew is installed outside of usr/local then the sudo brew command will fail as the PATH variable in the execution environment most likely won't include the brew executable.
One idea is to pass --preserve-env=PATH to the invocation to sudo, but that requires the executing user to have the brew executable on their PATH. Another solution would be to get the full path to the executable using brew --prefix but that has the same requirement. Is that an acceptable constraint?
If homebrew is installed outside of usr/local then the
sudo brew
command will fail as thePATH
variable in the execution environment most likely won't include thebrew
executable.One idea is to pass
--preserve-env=PATH
to the invocation tosudo
, but that requires the executing user to have thebrew
executable on theirPATH
. Another solution would be to get the full path to the executable usingbrew --prefix
but that has the same requirement. Is that an acceptable constraint?I'm happy to provide a patch.