opscode-cookbooks/homebrew — pull request #13 by Govan (2012-11-29 23:02:41+00:00)
Title: [COOK-1539] Homebrew won't run as root

Running chef-client as root results in brew running as root. As of Brew 0.9.2, brew will refuse to run as root.
```
$ sudo brew install nginx
Cowardly refusing to `sudo brew install'
```

When Chef runs any brew-backed installs will silently fail.

The package resource doesn't have a user attribute and, IMHO, it would be odd if it did seeing as brew is the only package manager that runs as non-root. My current workaround is to give brew a nominated user to run as:

```
node["homebrew"]["run_as"] = "leftbrained"
```