Comment by pdntspa

3 days ago

Does this handle macOS installs with multiple local users? I have to su into account 1 if I want to brew install something from account 2

brew as-console-user may help here. We don’t support a multiuser setup so there may be some limitations but we try our best to address problems as they come up.

  • Is there more documentation than this?

    > as-console-user command [args …]

    > Run a Homebrew command as the active macOS console user.

    > This is intended for MDM, Munki and Jamf workflows where brew is invoked as root but Homebrew operations should run as the logged-in console user. The nested command is always dispatched through HOMEBREW_BREW_FILE.

    https://docs.brew.sh/Manpage#as-console-user-command-args-

    This isn’t very informative. Is there more documentation somewhere else that I’m missing? Google search doesn’t really find much.

    I currently have a dedicated `homebrew` user that I access with `alias brew='sudo --set-home --user=homebrew --chdir /Users/homebrew -- brew' but it’s got a number of shortcomings. What will as-console-user do differently to this?