I was trying to install Nodejs using Homebrew (I'm using macOS Sierra 10.12.6) so I wrote in the terminal:
brew install node
and it returned:
Error: /usr/local/Cellar is not writable. You should change the
ownership and permissions of /usr/local/Cellar back to your
user account:
sudo chown -R $(whoami) /usr/local/Cellar
Error: Cannot write to /usr/local/Cellar
Then I wrote:
sudo chown -R $(whoami) /usr/local/Cellar
and it returned:
usage: chown [-fhv] [-R [-H | -L | -P]] owner[:group] file ...
chown [-fhv] [-R [-H | -L | -P]] :group file ...
After that I tried with:
sudo chown -R $(whoami) $(brew --prefix)/*
and it returned:
chown: /usr/local/Cellar: illegal user name
May I have your help please? (Note: the username is the right one)