Using visudo to edit sudoers on Mac
If your visudo does not work as expected, maybe because your editor does not work correctly, try setting the the EDITOR environment variable to a sane value, then launching visudo:

EDITOR=nano visudo


for sh, bash, dash, and compatible.