Categories
General

Custom sudo in macOS

This is a little macOS quality of life thing I recently learned and documenting here for my future self.

Like many other command line junkies, I use a custom sudoers file to make sudo more convenient. However unlike in previous years, I’ve noticed the past few times I upgrade macOS, both minor/point updates and the recent Big Sur beta, my sudo customizations (i.e. the sudoers file) get swallowed, and I have to manually restore.

Now in fairness macOS is at least polite enough to move the file into this ‘Relocated Items’ folder instead of deleting it outright. But still a hassle to manually patch.

TIL it seems you can simply drop in sudoers customizations into a new file inside
/private/etc/sudoers.d

As far as I can tell sudo config customizations placed here will survive macOS upgrades, which means one less manual chore for me next time. Less churn = happier me.