macOS Terminal Permission – How to Make /usr/local Writable for Homebrew

homebrewmacospermissionterminal

I've been trying to get homebrew working nicely, but it appears everything inside /usr/local isn't writable, and everything falls over.

It keeps telling me to recursively chown /usr/local, and I tried that. Operation denied, so I sudo'd it. It seemed to work, but with an eerie silence that I hear is considered polite in Unix. Unfortunately, any succeeding attempts at brew update meet with the same cacophony of errors.

I reran the command with -v and it looks the operation is not permitted for anything inside.

As much as the answer is probably "learn UNIX" I'm just trying to comply with some job requirements here for a tutorial on Ruby, so that's a few steps above where I'm currently at.

brew doctor:

Warning: /usr/local/Frameworks isn't writable.

This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/Frameworks
Warning: /usr/local/Cellar isn't writable.
You should `chown` /usr/local/Cellar
Warning: /usr/local/etc isn't writable.

This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/etc
Warning: /usr/local/include isn't writable.

This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/include
Warning: /usr/local/lib isn't writable.

This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/lib
Warning: /usr/local/lib/pkgconfig isn't writable.

This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/lib/pkgconfig
Warning: /usr/local/opt isn't writable.
You should `chown` /usr/local/opt
Warning: /usr/local/share isn't writable.

This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/share
Warning: Some directories in /usr/local/share/man aren't writable.
This can happen if you "sudo make install" software that isn't managed
by Homebrew. If a brew tries to add locale information to one of these
directories, then the install will fail during the link step.
You should probably `chown` them:

    /usr/local/share/man
    /usr/local/share/man/man1
    /usr/local/share/man/man3
    /usr/local/share/man/man5
    /usr/local/share/man/man7
    /usr/local/share/man/man8
Warning: /usr/local/var isn't writable.

This can happen if you "sudo make install" software that isn't managed by
by Homebrew. If a formula tries to write a file to this directory, the
install will fail during the link step.

You should probably `chown` /usr/local/var

Best Answer

This should be solved changing the perms on that directory in the following way:

$ cd /usr/local
$ sudo chown -R <your-username>:<your-group-name> *

If you don't know your group, just type id -g.