brew install Error: /usr/local/Cellar is not writable (Homebrew, macOS)

preview_player
Показать описание
If you get the following error when trying to install or upgrade packages on your Mac by using Homebrew:

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

One of the following commands should solve it:

This one might work on older operating systems:

sudo chown -R $(whoami) /usr/local

However, on newer operating systems, you can’t change permissions for the directory /usr/local itself — but you can change the permissions for folders inside it by adding a forward slash and an asterisk:

sudo chown -R $(whoami) /usr/local/*

If the above doesn’t work, try running this command instead:

sudo chown -R $(whoami) $(brew --prefix)/*

Was this helpful to you?

My website
Рекомендации по теме
Комментарии
Автор

your an absolute hero man, thanks so much. Simple video so much better than all the stuff on stackoerflow

GuglielmoRiva
Автор

It worked for me (using it on a zsh shell / MacOS Ventura) Thank you!

refugeenius
Автор

after follow every steps i save my valuable time

chandreshdadhaniya
Автор

thanks man your solution still worked.

prayaspanchuri
Автор

thaanksss, it works perfectly, I was trying to install mongodb and now with your solution I could

dirtman
Автор

SO easy and it worked exactly as you said it would thank you thank you

MEDA
Автор

I got a "bad file descriptor" error trying to brew upgrade after updating to macos 11.4 on a silicon macbook pro and this fixed it. I wonder why the permissions were wrong. everything in /usr/local/Cellar was root and now it works because it was changed to my user

paul
Автор

Thanks a ton for taking time and making this video, truly appreciate your effort!
It doesn't work for me @techstacker. your commands work, I tried installing npm with homebrew and seems like I ended up with an error::
Error: An unexpected error occurred during the `brew link` step
The formula built, but is not symlinked into /usr/local
Permission denied @ dir_s_mkdir - /usr/local/share

Posting it here as this might help other members that were facing similar issue.

adityareddy