dotfiles
dotfiles copied to clipboard
adds fixbrew alias
This adds a clever, unix-y alias to change a user's Homebrew files back to the correct user and group.
alias fixbrew='chown -R `whoami`:admin $(brew --prefix)'
I’m not familiar with this problem. Could you elaborate?
Uncommonly, homebrew users run into permission errors when using homebrew. (If you like, I could show you dozens of links, especially to Stack Exchange sites, to support this assertion.) The homebrew wiki suggests the following to fix such errors:
sudo chown -R $(whoami) /usr/local
However, this is incomplete in two respects. First, it doesn't include the group (i.e., chown user:group
). Secondly, it assumes that the HOMEBREW_PREFIX
is always /usr/local
, whereas, in rare cases, users choose a custom HOMEBREW_PREFIX
, such as /opt
, /opt/brew
or whatever.
Now, I suggest and alias
sudo chown -R $(whoami):admin $(brew --prefix)
to fix both problems. According to the homebrew install script, the group should be admin
. This alias sets it to $USER:admin
. Secondly, just in case the user has a custom HOMEBREW_PREFIX
, this alias will fix permissions in the correct homebrew directory in all cases.
If you have more questions, please let me know. :-)
On Mojave, in my experience, this step is no longer necessary.