Sunday, April 24, 2016

How to Verify & Repair Permissions in OS X El Capitan

The Disk Utility app has long contained the ability to verify and repair disk permissions on a Mac, but in the latest versions of OS X this ability has been removed. That doesn’t mean you can’t verify permissions and repair permissions in OS X El Capitan 10.11 and later however, you just need to turn to the command line to do so.

To be clear, verifying and repairing disk permissions has long been over assigned as a remedy to all sorts of issues on the Mac, most of which are rarely accurate or legitimate. In this sense, repairing permissions is sort of considered a form of hocuspocus with little benefit to most OS X situations, but nonetheless there are some unique circumstances where you may want to verify and repair disk permissions in OS X anyway, particularly if a files permissions are actually off, meaning the ability for certain users and processes to read and write particular files and folders.
Note this is not the same as verifying and repairing a disk.

How to Repair Verify Disk Permissions in OS X El Capitan

Open the Terminal application (found in /Applications/Utilities/) and use the following syntax to verify a volumes permissions, this will verify the default root volume of a Mac:
sudo /usr/libexec/repair_packages --verify --standard-pkgs /
If you want to verify permissions on a different drive, specify the volume rather than “/”
The command will run and either show permissions that differ, or nothing, depending on what’s found. Not surprisingly, you’ll likely find some variation of permissions that differs, looking something like:
Permissions differ on "usr/libexec/cups/cgi-bin", should be drwxr-xr-x , they are dr-xr-xr-x .
Permissions differ on "usr/libexec/cups/daemon", should be drwxr-xr-x , they are dr-xr-xr-x .
Permissions differ on "usr/libexec/cups/driver", should be drwxr-xr-x , they are dr-xr-xr-x .
Permissions differ on "usr/libexec/cups/monitor", should be drwxr-xr-x , they are dr-xr-xr-x .

How to Repair Disk Permissions in OS X El Capitan from Command Line

Assuming permissions have been found which differ and you’d like to repair them, replace the –verify flag with –repair, and again point the command at the same volume:
sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume /
Repairing permissions may take a while, just like it did from Disk Utility.
Verify and repair disk permissions in OS X from command line
If you execute the repair_packages command without sudo and with no specifications or flags, you’ll get a simple help guide instead:
$ /usr/libexec/repair_packages
Usage: repair_packages [ARGUMENTS]...

Commands:
--help Print this usage guide.
--list-standard-pkgs Display the package ids in the standard set.
--verify Verify permissions on files in the specified package(s).
--repair Repair permissions on files in the specified package(s).
Options:
--pkg PKGID Verify or repair the package PKGID.
--standard-pkgs Verify or repair the standard set of packages.
--volume PATH Perform all operations on the specified volume.
--output-format # Print progress info using a special output format.
--debug Print debuging information while running.

As suggested, this is not really something that should be run on a regular basis as any part of Mac maintenance routine, and it’s rarely necessary, which is likely why Apple pulled it from the Disk Utility application.
By the way, earlier releases of OS X also have a command line approach to repairing disk permissions, but it’s handled through the Disk Utility command line tool instead.

No comments:

How to use DiskSpd to simulate Veeam Backup & Replication disk actions

This HOW-TO contains information on how to use Microsoft© DiskSpd to simulate Veeam Backup & Replication disk actions to measure disk pe...