-- Drupal and Web Development

Notice: this post was last updated 3 years 14 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