If someone tries to use brew
with sudo
, a warning will show up:
1 | Error: Cowardly refusing to `sudo brew [option]` |
Well, you may continue to run it after use sudo -i
, but you will laterly have many problems. While brew
is running under root
, it will change the ownership of folders like /usr/local/include
to root
. And later if you want to run commands like brew link
, you will fail:
1 | Error: Could not symlink include/gdbm.h |
To recover this, you must change the ownership back:
1 | sudo chown -R $(whoami) /usr/local/include |
And remember: Do not try sudo brew
the next time.