Home > Back-end >  Updating nodejs with homebrew dilemma: need more permission but brew doesn't work with sudo?
Updating nodejs with homebrew dilemma: need more permission but brew doesn't work with sudo?

Time:10-21

I am trying to update node from 10 to 12 on my mac 11.6 (20G165).

And I would like to use the homebrew way:

brew upgrade node

However, after running this, I got:

$ brew upgrade node
Error: The following directories are not writable by your user:
/usr/local/share/man/man5
/usr/local/share/man/man7

Well, then I tried the sudo way:

sudo brew upgrade node
Password:
Error: Running Homebrew as root is extremely dangerous and no longer supported.
As Homebrew does not drop privileges on installation you would be giving all
build scripts full access to your system.

What should I do to fix it now?

Can I just grant the

/usr/local/share/man/man5
/usr/local/share/man/man7

directories to my current user? Is there any risk by doing so?

My homebrew version:

Homebrew 3.2.17
Homebrew/homebrew-core (git revision 0e79905a9e5; last commit 2021-10-20)

CodePudding user response:

Well I had a same problem, and solved it by commands provided which were followed by error.

sudo chown -R $(whoami) /usr/local/share/man/man5 /usr/local/share/man/man7

And make sure that your user has write permission.

chmod u w /usr/local/share/man/man5 /usr/local/share/man/man7
  • Related