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.)
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:
- Open Terminal.app (I like to hit Command+Space, then type "Terminal.app", then hit Enter).
sudo nano /etc/sudoers.
Append the following text to the file, where username is your short username (type
whoamiinto the terminal to get it):
- For option a:
%username ALL=(ALL) NOPASSWD
- For option b:
%username ALL= NOPASSWD: /Applications/XAMPP/xamppfiles/xampp
Press Ctrl+x, and save when prompted.
Note that on OSX Mavricks, you may have to add a % sign before the username (in
FYI I added this: "username ALL= NOPASSWD: /Applications/XAMPP/XAMPP\ Control.app"– EricAug 10, 2012 at 20:57
etc/sudoernoobs, like me, be careful not to edit
sudoersfile using your favorite text editor (just made this mistake … spent last hour trying to fix). The
sudoerfile 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.– mhulseAug 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 :
- Write scripts that start and stop XAMPP, specifying the password in the scripts.
The two scripts are included in the thread.
- Edit the
/etc/sudoersfile, configuring that
sudo /Applications/XAMPP/xamppfiles/xampp startdoesn't need a password.
Using the Script and Exporting it as a .App was the best solution. Thanks.– MoeDec 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
macOS also will not allow to use
vim sudoers (you cannot save), at least with activated SIP.
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