How to change the ownership of the unwritable directories for Homebrew

bashhomebrewpermissionterminal

I had admin account before and I deleted the admin and made the user as admin because it was bit of pain in neck. This is now the admin user called zuhairhallak. Before, installing Homebrew, it was just user without any privileges. I want to fix that. I tried to remove Homebrew but it did not let me.

zuhairs-mbp:~ zuhairhallak$ sudo chown -R $zuhairhallak /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/man/man8 /usr/local/share/zsh /usr/local/share/zsh/site-functions
Password:
chown: /usr/local/share/aclocal: illegal user name

Best Answer

I would start with a simpler command.

sudo chown -R 501 /usr/local/share/aclocal

Use a user number instead of name to see if that’s he error. Also, do one directory first to be sure where the error arises. You could even skip the -R if the above command fails to further reduce the variables in play.