Errno::EPERM: Operation not permitted @ dir_s_mkdir – /usr/local/Cellar

By | July 9, 2020

If you are getting this error while running brew, you are probably missing some important folders.

This is the full error here:

Error: No such file or directory @ dir_chdir - /usr/local/Cellar
Warning: Bottle installation failed: building from source.
Error: An exception occurred within a child process:
  Errno::EPERM: Operation not permitted @ dir_s_mkdir - /usr/local/Cellar

To fix this, run

brew doctor

You will probably see this:

p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 17.0px Menlo; color: #2fff12; background-color: #000000; background-color: rgba(0, 0, 0, 0.9)} span.s1 {font-variant-ligatures: no-common-ligatures; color: #9fa01c} span.s2 {font-variant-ligatures: no-common-ligatures}
Warning: The following directories do not exist:
/usr/local/Cellar
/usr/local/Frameworks
/usr/local/include
/usr/local/lib
/usr/local/opt
/usr/local/sbin


p.p1 {margin: 0.0px 0.0px 0.0px 0.0px; font: 17.0px Menlo; color: #2fff12; background-color: #000000; background-color: rgba(0, 0, 0, 0.9)} span.s1 {font-variant-ligatures: no-common-ligatures}
You should create these directories and change their ownership to your account.
  sudo mkdir -p /usr/local/Cellar /usr/local/Frameworks /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin
  sudo chown -R $(whoami) /usr/local/Cellar /usr/local/Frameworks /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin

So go ahead and run the suggested commands to create the required directories as well as the right permissions.

sudo mkdir -p /usr/local/Cellar /usr/local/Frameworks /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin

sudo chown -R $(whoami) /usr/local/Cellar /usr/local/Frameworks /usr/local/include /usr/local/lib /usr/local/opt /usr/local/sbin

Everything should work now!

Category: OSX

Leave a Reply

Your email address will not be published. Required fields are marked *