Skip to content

Instantly share code, notes, and snippets.

@berkedel
Created January 3, 2020 11:21
Show Gist options
  • Save berkedel/5a3c2dd1fb8315b2fea911a9777e93da to your computer and use it in GitHub Desktop.
Save berkedel/5a3c2dd1fb8315b2fea911a9777e93da to your computer and use it in GitHub Desktop.
Fix `sudoers` issue on macOS Catalina

Fix sudoers Issue on macOS Catalina

If you messed up with editing sudoers, this solution is for you. The solution is limited to restoring /etc/sudoers file to the original state. It is easier to mess up your config such as saving wrong format, etc.

How to Fix

  • Please reboot your macOS into recovery mode. While rebooting press and hold Cmd+R key.
  • After you completely reboot, you will see a dialog. You need to open Terminal by clicking Utilities > Terminal on menu.
  • In order to mount /etc as writable state, you need to disable SIP first by executing csrutil disable.
  • Reboot into single user mode. While rebooting press and hold Cmd+S key.
  • Mount /etc as writable state by executing mount -uw /System/Volumes/Data.
  • Make sure /etc/sudoers file and /etc/sudoers.d folder ownership is set to root. If not, execute chown root:wheel /etc/sudoers and chown root:wheel /etc/sudoers.d.
  • Make sure there is no /etc/sudoers~. If yes, please delete it.
  • Under /etc/sudoers.d directory, delete all files if needed.
  • Reboot into recovery mode to enable SIP. In terminal execute csrutil enable.
  • Finally reboot into normal mode.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment