Added myself to /etc/sudoers but sudo still asks for password This is my /etc/sudoers file edited with visudo, but I'm still asked to enter my password when doing sudo.  

root ALL=(ALL) ALL
%admin  ALL=(ALL) NOPASSWD:ALL
petruza  ALL=(ALL) ALL
petruza  ALL=(ALL) NOPASSWD:ALL

## Uncomment to allow members of group wheel to execute any command
%wheel ALL=(ALL) ALL

## Same thing without a password
%wheel ALL=(ALL) NOPASSWD: ALL


I had this running in previous OS installs but now it doesn't work.  

My main need for this is to automatically execute xampp at startup and not having it asking me for the password.
None of your modifications of the sudoers file is needed if you start xampp with a launch daemon:


Create a file org.xampp.startup.plist  in /Library/LaunchDaemons with sudo touch/nano ... and the following content:

&lt;?xml version="1.0" encoding="UTF-8"?&gt;
&lt;!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt;
&lt;plist version="1.0"&gt;
&lt;dict&gt;
        &lt;key&gt;Label&lt;/key&gt;
        &lt;string&gt;org.xampp.startup&lt;/string&gt;
        &lt;key&gt;ProgramArguments&lt;/key&gt;
        &lt;array&gt;
                &lt;string&gt;/bin/bash&lt;/string&gt;
                &lt;string&gt;/Applications/XAMPP/xamppfiles/xampp&lt;/string&gt;
                &lt;string&gt;start&lt;/string&gt;
        &lt;/array&gt;
        &lt;key&gt;RunAtLoad&lt;/key&gt;
        &lt;true/&gt;
        &lt;key&gt;StandardErrorPath&lt;/key&gt;
        &lt;string&gt;/tmp/org.xampp.startup.stderr&lt;/string&gt;
        &lt;key&gt;StandardOutPath&lt;/key&gt;
        &lt;string&gt;/tmp/org.xampp.startup.stdout&lt;/string&gt;
&lt;/dict&gt;
&lt;/plist&gt;


If you installed XAMPP somewhere else please modify &lt;string&gt;/Applications/XAMPP/xamppfiles/xampp&lt;/string&gt; accordingly.
chown/chmod the file:

sudo chown root:wheel /Library/LaunchDaemons/org.xampp.startup.plist
sudo chmod 644 /Library/LaunchDaemons/org.xampp.startup.plist

Load the daemon with:

sudo launchctl load /Library/LaunchDaemons/org.xampp.startup.plist

If everything runs well, you may remove the following part of the plist:

        &lt;key&gt;StandardErrorPath&lt;/key&gt;
        &lt;string&gt;/tmp/org.xampp.startup.stderr&lt;/string&gt;
        &lt;key&gt;StandardOutPath&lt;/key&gt;
        &lt;string&gt;/tmp/org.xampp.startup.stdout&lt;/string&gt;

Restore the default sudoers file with visudo:

...
root ALL=(ALL) ALL
%admin  ALL=(ALL) ALL

## Uncomment to allow members of group wheel to execute any command
#%wheel ALL=(ALL) ALL

## Same thing without a password
#%wheel ALL=(ALL) NOPASSWD: ALL
...