OSX recovering ownership after bad chown command
OS X Yosemite (10.10) and older:


Applications &rarr; Utilities &rarr; Disk Utility
Select the startup disk from the list of volumes.
Click the First Aid tab.
To check permissions, click Verify Disk Permissions. To repair permissions, click Repair Disk Permissions.


Source: https://support.apple.com/en-au/HT201560

You can also do it from Terminal using the diskutil command.

OS X El Captian (10.11):


Applications &rarr; Utilities &rarr; Terminal
To verify permissions:

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

To repair permissions:

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



Type your password when prompted. You'll need to be root or a member of the admin group.

Source: http://osxdaily.com/2015/11/04/verify-repair-permissions-mac-os-x/