Missing Sudo

If you have the pleasure of binding your macOS fleet to Active Directory some of you may have noticed issues using the sudo command for administrative users.

Chatter on the MacAdmins slack channel suggests that Apple has acknowledged the issue and will resolve it in a future update. Here’s how we’re temporarily working around this:


# Collects the logged in user
loggedInUser="$(stat -f%Su /dev/console)"

# Checks to ensure logged in user isn't already in sudoers
if grep -Rq "$loggedInUser" /etc/sudoers
    echo "User ID already exists in sudoers file...Exiting"
    echo "$loggedInUser        ALL = (ALL) ALL" >>  /etc/sudoers

Short and sweet. Run as root.