I've erased the password from preferencenow I can log in without using any password but when I run a sudocommand terminal ask me a password if I insert nothing or the old one it return error. What's happen?

  • Is your username preference ? sudo uses the password of the current user.
    – mmmmmm
    Dec 12, 2013 at 12:31
  • 1
    Go to Settings > Users & Groups, then click on Login Options and chose yourself as "Automatic login" if this is what you are trying to archieve. Leaving your account without a password is not recommended.
    – napcae
    Dec 12, 2013 at 13:18

2 Answers 2


sudo requires a password by default on Mac OS X.

Apple's knowledge base article explains more, Mac OS X: sudo command requires a non-blank admin password:

In Mac OS X v10.5 through 10.5.8, if you press the Return key at the password prompt without entering a password (even if the user has no password, which is not recommended), the command entered will not execute and you will be returned to a command prompt.

In Mac OS X v10.6 or later, if you press the Return key at the password prompt without entering a password, the message "Sorry, try again." will be displayed and you will be prompted for a password again.

If your administrator account has no password (a blank password), you must give that user a password before using the sudo command.

If you must remove the need for a password to use sudo, you can edit the /etc/sudoers file using visudo command. A thread on macoshints discusses how:

Use the visudo command as root.

Look for the line:

%admin ALL=(ALL) ALL

Change it to:


Requiring a password is highly recommended. Removing this check reduces the security of your Mac and exposes your computer to attack or abuse.


Based off of what you have written so far, I am assuming you are running 10.7 or newer on your computer. When you have Mac OS Lion or newer then sudo actually requires a password either from an Admin account or with a password set up for root user.

If you are no admin then sudo is out of your hands. If you are then your password must be something. Leaving your password empty is not possible of you have to sudo. Temporarily add a password to the account and then proceed. If these tips don't help then please provide feedback with what you are experiencing in greater detail.

You must log in to answer this question.

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