Mac OS X - fire up Apache/Mysql without prompting for password
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.)
Problem
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.
Solution
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).
- Run
sudo nano /etc/sudoers
. -
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
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
).
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/sudoers
file, configuring thatsudo /Applications/XAMPP/xamppfiles/xampp start
doesn't need a password.