12

I have been trying to use brew to install tmux but every time I put in brew install tmux it would tell me:

Error: Could not create /usr/local/Cellar Check you have permission to write to /usr/local

I then tried to do it with sudo but it did not work, which I guest would would not seeing that brew does not want to be used with root. I have already made sure that all the files that are in /usr/local belong to me. I can’t change the /usr/local file; it says: “Operation not permitted”. How can I fix this so Cellar can be created and allow me to install stuff using brew?

StrangeRanger
  • 299
  • 1
  • 2
  • 10

4 Answers4

20

I solved it by creating the /usr/local/Cellar directory (and any other directories it may require) by hand and owning them.

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

Then rerun your command.

iFreilicht
  • 13,271
  • 9
  • 43
  • 74
chukcha14
  • 316
  • 3
  • 5
10

i found mine also in

/opt/homebrew/Cellar

mac m1(if this info helps

amgma
  • 109
  • 1
  • 2
  • 1
    Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – Community Jan 14 '22 at 00:21
  • I could not find this yet in the homebrew docs. Happy to have at least found it here. – Sjoerd222888 Jul 08 '22 at 08:04
7

Before run any brew command do these steps:

1- $ brew update

2- brew doctor

3- If brew doctor shows the warning or error, just fix them , it also shows the solution and the command that you need so copy & paste the command & run it, that's simple

4- install what you need, for example node :

brew install node
Hamed Jaliliani
  • 2,789
  • 24
  • 31
2

I found my Cellar directory in

/opt/homebrew/Cellar/

Crabigator360
  • 822
  • 10
  • 9