`brew link unbound` returns `/usr/local/sbin is not writable` error
By default /usr/local/sbin doesn't exist. The folder should be created by installing brew, the owner/permissions are set to $(whoami):admin/775. Most/all folders in /usr/local/ are owned by the user who installed brew - that's part of the default installation and configuration.

On the other hand some third-party tool may have been installed to this folder previously (e.g AFAIR procexp or Smartmontools have to be installed there).
Then the owner/permissions are probably set to root:wheel/755 or root:wheel/775

To solve your problem check whether /usr/local/sbin exists and its folder permissions.

The following command creates this folder if it doesn't exist and makes it world writable, but doesn't change owner:group:

if [ ! -d /usr/local/sbin ]; then sudo mkdir /usr/local/sbin; fi &amp;&amp; sudo chmod 777 /usr/local/sbin


Now you can link unbound:

brew link unbound


You may undo the world writable step with:

sudo chmod 775 /usr/local/sbin


Don't forget to add the folder to your user's PATH in ~/.bash_profile or the system's PATH in /etc/paths.



If you get the error:

Error: Could not symlink sbin/unbound
/usr/local/sbin is not writable.


the user doesn't have permissions to write to the folder with the command actually executed.

The command sudo chown -R $(whoami) /usr/local will change the owner of all subfolders and their content to $(whoami) despite the error chown: /usr/local: Operation not permitted. The only exception will be a SIP protected item in /usr/local/. By default none of the files and folder is protected though.

Thus the error message is erroneous and you probably already have been successful by entering your sudo chown -R ... command and you should have tried to simply linked unbound once more.

You can check the folder permissions by entering:

ls -lae /usr/local/sbin


You can get all a protected items in subdirectories of local by entering:

ls -lae -R /usr/local | grep restricted