I am running XAMPP which comes with a little "XAMPP Control" app that lets me start and stop Apache and MySQL by clicking a button. When I do that, I'm prompted by Lion for my admin password. Is there a way to skip this step? (On Windows, this is sort of like me asking "how can I run the XAMPP Control program in administrator mode?" --not sure if there's an analog for Mac.)

3 Answers 3



Mac OSX asks you for your password because XAMPP is trying to run the *nix command [sudo](http://en.wikipedia.org/wiki/Sudo). This can be overcome by one of two ways:

a. Allow ALL sudo commands to be run without a password.

b. Allow ONLY the XAMPP command to be run with no password.


To use one of these solutions, do the following:

  1. Open Terminal.app (I like to hit Command+Space, then type "Terminal.app", then hit Enter).
  2. Run sudo nano /etc/sudoers.
  3. Append the following text to the file, where username is your short username (type whoami into the terminal to get it):

    • For option a:

    %username ALL=(ALL) NOPASSWD

    • For option b:

    %username ALL= NOPASSWD: /Applications/XAMPP/xamppfiles/xampp

  4. Press Ctrl+x, and save when prompted.

Note that on OSX Mavricks, you may have to add a % sign before the username (in /etc/sudoers).

  • FYI I added this: "username ALL= NOPASSWD: /Applications/XAMPP/XAMPP\ Control.app"
    – Eric
    Aug 10, 2012 at 20:57
  • For etc/sudoer noobs, like me, be careful not to edit sudoers file using your favorite text editor (just made this mistake … spent last hour trying to fix). The sudoer file has this commented message at the top: This file MUST be edited with the 'visudo' command as root (i.e., $ sudo visudo). Failure to use 'visudo' may result in syntax or file permission errors that prevent sudo from running.
    – mhulse
    Aug 4, 2014 at 1:55
  • Use the visudo command. It will check the file syntax before 'commiting' it. Dec 21, 2015 at 21:16

The thread Starting Xampp Control Panel without password lists two possible solutions :

  1. Write scripts that start and stop XAMPP, specifying the password in the scripts.
    The two scripts are included in the thread.
  2. Edit the /etc/sudoers file, configuring that sudo /Applications/XAMPP/xamppfiles/xampp start doesn't need a password.
  • Using the Script and Exporting it as a .App was the best solution. Thanks.
    – Moe
    Dec 26, 2014 at 6:21

macOS High Sierra

In High Sierra I couldn't get the new control app manager-osx working without entering password, even when adding it in sudoers.

But you can run xampp from command line to start and stop xampp (or only apache) without password, if you add it to the sudoers file.

But: The solutions above made problems for me, so here what I did:

Do not edit /etc/sudoers/ file, many things can go wrong! If you really want, use sudo visudo
macOS also will not allow to use vim sudoers (you cannot save), at least with activated SIP.

Better approach

Create a new file in the directory /etc/sudoers.d. You need root rights to create the file.
Name the file like your username (for example). No extension needed.
Filename doesn't really matter, but it must not cotain a ~ at end or a dot (.) at beginning.

In this new file create only the needed entries, but DON'T add a % in front of your username. This didn't work for me and every call of sudo took a long time before asking the password.

Content of the new file:

username ALL = NOPASSWD: /Applications/XAMPP/xamppfiles/xampp

Now you can run

sudo /Applications/XAMPP/xamppfiles/xampp start

in a Termin to start xampp and you don't have to enter your password.

If something goes wrong

Delete all your entries in the sudoers or the new file, or comment them with double ## so sudo will ignore them.
Try this, if file is completely broken: https://astrails.com/blog/2009/09/29/how-to-fix-a-hosed-etc-sudoers-file-on-mac-osx
If nothing else works, reboot to single user mode and repair the file. There should also be a backup in /etc called sudoers~orig.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.