-- Drupal and Web Development

Notice: this post was last updated 3 years 11 weeks ago so it might be outdated. Please be cautious before implementing any of suggestions herein.

Restarting MAMP's Apache from the command line

First thing, you need to have the correct executable in your $PATH:

sudo mv /usr/sbin/apachectl /usr/sbin/apachectl-mac
sudo ln -s /Applications/MAMP/Library/bin/apachectl /usr/sbin/apachectl

Next you need to give yourself access to call `sudo apachectl restart` without having to enter a password:

sudo visudo

Learn how [vi text editor]( works, and In the ensuing file, enter the following line, where `my_mac_user_name` is your username on the command line (find it by typeing `whoami`):

my_mac_user_name ALL=(root) NOPASSWD: /Applications/MAMP/Library/bin/apachectl

Now you can restart Apache from the command line by typing:

sudo apachectl restart

Post new comment

  • Web page addresses and e-mail addresses turn into links automatically.
  • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd> <h3>
  • Lines and paragraphs break automatically.
  • You may post code using <code>...</code> (generic) or <?php ... ?> (highlighted PHP) tags.

More information about formatting options

By submitting this form, you accept the Mollom privacy policy.