Edited sudoers file with text editor - now can't run sudo

I see you've tagged your question osx so if you've done this on a mac, make use of the GUI.

  1. Open any Finder window and press cmd shift G
  2. Type /etc/sudoers and press return to go to the file
  3. Press cmd i with the file highlighted
  4. Scroll to the bottom of that info window to 'Sharing & Permissions' and click the lock icon in the bottom right
  5. Type an admin username and password
  6. Now add yourself in that window with the + button and select 'Read and Write' privileges
  7. Open the file in any editor and fix what you screwed up the first time!

Tags:

Sudo

Osx