The problem usually arises when ownership for /etc/sudoers is not set correctly.
Step by Step guide to resolve the problem:
In Terminal run
and check if the output on terminal includes this line
drwx------ 3 root wheel 102 Nov 24 00:57 ts
If it includes, fine, proceed to step 2.
If not, note this thing in your mind, you will need it later.
- Start up in recovery mode (Cmd+R during boot up)
- Disk Utilities > Select Macintosh HD, and Mount
- Close Disk Utilities
- Utilities > Terminal
chown root:wheel /Volumes/Macintosh\ HD/etc/sudoers
- If in step 1, the terminal output there was not what was required and you noted something in your mind in that step, run
chown -R root:wheel /Volumes/Macintosh\ HD/var/db/sudo/ts/. No need to run this command if u noted nothing in your mind in step 1.
- Reboot or Restart
Point to be noted: Actually
chown root:wheel /etc/sudoers this is something actually we need to do but without recovery mode we will not be able to run this command. So the above steps worked for me for Mac OS Mojave 10.14.6.