MacOS – How to reset to default permissions on El Capitan


During development and debugging I have changed permissions of various files and folders using chown and chmod on my local system (I didnt maintain the list of changes). Now that I have fixed the issue, i fear of security consequences.
Any way I could restore the default permissions and/or find vulnerabilities in terms of network security or other potential loop holes that might create due to my changes.

Best Answer

For system installed packages you can run the following command in to find permissions that differ from the default:

sudo /usr/libexec/repair_packages --verify --standard-pkgs /

If you want to just apply those permissions to your system as a whole, run the following command:

sudo /usr/libexec/repair_packages --repair --verify --standard-pkgs /

Or you could individually fix the permissions that you have changed yourself using chmod/chown.

For everything else, you need to have used either a package manager that can verify permissions, or have a backup you can use for comparing permissions before and after the event.

For others: Please note that the repair_packages command no longer exists in Sierra and newer macOS versions, as they now automatically handle repairing permissions. If you have manually messed up permissions so much that they cannot be fixed automatically, I would recommend restoring permissions from a Time Machine backup or similar.