My single user (let's say u0) has over the years become cluttered.

I decided to create a new admin user u1, and incrementally migrate to it.

However I'm bumping into obstacles.

First up I'm switching u1's shell to bash. So I want to brew install bash to get the latest (5.x).

> brew --version
Homebrew >=2.5.0 (shallow or no git repository)
fatal: detected dubious ownership in repository at '/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core'
To add an exception for this directory, call:

    git config --global --add safe.directory 

I found a fix on SO:

git config --global --add safe.directory '*'

But now:

> brew install bash
Error: Can't create update lock in /usr/local/var/homebrew/locks!
Fix permissions by running:
  sudo chown -R $(whoami) /usr/local/var/homebrew
Error: The following directories are not writable by your user:

You should change the ownership of these directories to your user.
  sudo chown -R $(whoami) /usr/local/etc/bash_completion.d /usr/local/lib/pkgconfig /usr/local/lib/python3.7/site-packages /usr/local/share/aclocal /usr/local/share/doc /usr/local/share/info /usr/local/share/locale /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7 /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew/locks /usr/local/var/log

And make sure that your user has write permission.
  chmod u+w /usr/local/etc/bash_completion.d /usr/local/lib/pkgconfig /usr/local/lib/python3.7/site-packages /usr/local/share/aclocal /usr/local/share/doc /usr/local/share/info /usr/local/share/locale /usr/local/share/man /usr/local/share/man/man1 /usr/local/share/man/man3 /usr/local/share/man/man5 /usr/local/share/man/man7 /usr/local/share/zsh /usr/local/share/zsh/site-functions /usr/local/var/homebrew/locks /usr/local/var/log

yikes! So if I'm gona have to chown these /usr/local/... files to get brew to work, I'm worried (1) about messing up my original user, and (2) how much more tweaking I'm gona need before my u1 is established as the new admin user (i.e. everything works) -- at which point I won't care if u0 has issues.

How to play this? Options I see are:

  1. Just give up on migrating u0 -> u1, just tidy up u0 as best I can
  2. Keep pushing through, tweaking issues as they arise
  3. pre-emptively chown the whole filesystem (or big chunks of it) to u1

Am I missing something?

Am I pushing a round peg into a square hole again?

EDIT: https://stackoverflow.com/questions/41840479/how-to-use-homebrew-on-a-multi-user-macos-sierra-setup ^ This thread seems to cover all viable solution paths. The only one that looks mathematcally clean to me is covered here.

  • 1
    Yes, as documented Homebrew is a single-user system. There are kinda-sorta workarounds to use it in a multiuser environment, but they really just make Homebrew's basic security issue worse. Nov 16, 2022 at 14:45
  • For a multi user system use macports or nix - they are based around normal Unix practices. Homebrew elevates one user to be the owner and installer and user.
    – mmmmmm
    Nov 16, 2022 at 17:01


You must log in to answer this question.

Browse other questions tagged .