1. In OS X Yosemite and earlier,
When you have a trouble with the disk in your Mac, you may check if it has the right permission in the system files.
You can check easily by
sudo diskutil repairPermissions /
or Launch Disk Utility ->Select the Disk you want to repair -> Select “First Aid” -> Click “Repair Disk Permissions”
If your “sudo” fails, you can recover it by this
- Enable root
- System Preference -> User & Groups -> Login Options -> Network Account Server -> Open Directory Utility …
- Select “Edit” -> “Enable Root User”
- System Preference -> User & Groups -> Select “Show fast user switching menu as “Full Name”
- Then, you can switch root easily.
- Login as root or switch to root.
- Open Terminal
- chmod 4755 /usr/bin/sudo
- Done.
2. In OS X El Captain or later,
I’ve referred from How to Verify & Repair Permissions in OS X El Capitan
– Verify a permission error
sudo /usr/libexec/repair_packages --verify --standard-pkgs /
– Repair the permission errors
sudo /usr/libexec/repair_packages --repair --standard-pkgs --volume /