3

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)

Pier
  • 103
  • 1
  • 11
  • what does `whoami` print? – Gordon Davisson Dec 28 '17 at 08:10
  • My username, the same one that I used in the command – Pier Dec 28 '17 at 08:11
  • I also added my OS version in the question – Pier Dec 28 '17 at 08:13
  • 1
    Those `chown` errors look like it's not getting the correct name from `$(whoami)`. Try using your username explicitly (i.e. `sudo chown -R yourUserNameHere /usr/local/Cellar`). – Gordon Davisson Dec 28 '17 at 08:35
  • Already did it. I think the problem is that something about chown changed in Sierra – Pier Dec 28 '17 at 08:51
  • I'm pretty sure `chown` hasn't changed, and the usage message says it hasn't. The error messages suggest that it isn't getting your username (the last one suggests it's mistaking `/usr/local/Cellar` for the username), so something weird is happening. Either there's something strange about your username, or it's running a wrapper around `chown` that's messing things up, or... something I'm not going to think of without more information. – Gordon Davisson Dec 28 '17 at 18:37
  • I tried to run the command in the way that I wrote it, without changing (whoami) and it seems to work. – Pier Dec 29 '17 at 12:01

0 Answers0