MacOS – What does sudo chmod 0755 /usr/local and sudo chgrp wheel /usr/local do

homebrewmacospermissionterminal

I uninstalled Homebrew, manually removed the /usr/local contents.

The following possible Homebrew files were not deleted:

/usr/local/.DS_Store
/usr/local/bin/
/usr/local/etc/
/usr/local/include/
/usr/local/lib/
/usr/local/libexec/
/usr/local/share/
/usr/local/texlive/
/usr/local/var/

You may consider to remove them by yourself.

You may want to restore /usr/local's original permissions

  sudo chmod 0755 /usr/local
  sudo chgrp wheel /usr/local

I want to know what the suggested commands do.

Best Answer

When you perform the chmod 755 filename command you allow everyone to read and execute the file, and the file owner is allowed to write to the file as well. You may need this for Perl and other scripts that should to be run via a webserver. If you apply 755 to a directory, it means that everyone can go to it and get its file listing.

When you run chgrp group-name filename command you change the group of each filename to group-name.

Running both commands using sudo prefix let you be sure that the changes takes effect, because your run it as root that is the user with most permissions on every single unix like machine.

You can type man chmod, man chgrp or man sudo for more info and options.