So I manage to break sudo during this one day of owning MacMini M1. I manage to break sudo during editing /etc/pam.d/sudo. How I can edit it back? I tried using terminal in recovery mode. This file is not present there. su is turned off in macOS. Is reinstall the only way?

Update: I ended up with reinstalling Big Sur.

  • 2
    What did you edit into /etc/pam.d/sudo, how exactly does it not work afterwards? Also, if you boot into Recovery you usually need to mount your data disk first as Recovery boots into its own little partition.
    – nohillside
    Dec 11, 2020 at 6:13
  • I was installing github.com/biscuitehh/pam-watchid at one point I had to add new sudo. Since that every time I want to use sudo I go error sudo: unable to initialize PAM: No such file or directory I didn't know I had mount my data disk. I'll try :)
    – Błażej
    Dec 11, 2020 at 13:58
  • @nobillside I can’t /etc/pam.d/sudo in mounted disk
    – Błażej
    Dec 11, 2020 at 17:02

2 Answers 2


So, for those coming across this wanting to avoid re-installing... the M1 doesn't have a "Single User Mode", but booting into recovery (hold the power button when you start the machine) you can open Disk Utility and mount the "Data" partition that's next to your OS partition. Then close Disk Utility, open a terminal and run the following: (not sure if you'll need the "\ 1", but I did)

vi /Volumes/Data\ 1/private/etc/pam.d/sudo

and make it match this:

auth       sufficient     pam_smartcard.so
auth       required       pam_opendirectory.so
account    required       pam_permit.so
password   required       pam_deny.so
session    required       pam_permit.so

Then just reboot, and you should be good to go 👍


TARGET in the Makefile needs to be updated.

For example, I'm using an M1 Macbook Pro with macOS Big Sur 11.2.1, so I changed it to arm64-apple-macosx11.2

  • You probably should open an issue on the project page for this to have it fixed.
    – nohillside
    Mar 3, 2021 at 6:26

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .