how to revert default Mac Apache install to original
I've had major issues with my default Apache install ever since I installed MAMP. I've uninstalled MAMP now but I'm still getting issues such as multiple Apache processes running, not stopping/starting/restarting, and the Web Sharing option not showing the correct state in System Preferences. I'm assuming MAMP has changed something within the default version of Apache, is there any way to easily replace the entire Apache install?
Thanks, Alex
Solution 1:
Has another Apache been installed? From a terminal (Applications-> Utilities-> Terminal.app) try:
ps ax | grep httpd
You should see something like the following if your local web sharing is enabled:
25829 ?? Ss 0:00.04 /usr/sbin/httpd -D FOREGROUND -D WEBSHARING_ON 25831 ?? S 0:00.00 /usr/sbin/httpd -D FOREGROUND -D WEBSHARING_ON
Then try
ps ax | grep apache
This should return nothing if you are using the default install, but might if another server was installed.
If apache is running from anything other than /usr/sbin, then you may want to investigate your PATH environment variable in case it has been altered.
You could also try using the default httpd.conf file supplied by Apple (in case yours has been edited).
-
Make a backup of the current one
sudo cp /etc/apache2/httpd.conf /etc/apache2/httpd.conf.bak
-
Copy the 'original' httpd.conf file
sudo cp /etc/apache2/original/httpd.conf /etc/apache2/httpd.conf
-
Restart the web server
sudo apachectl restart
On a side note.. If you are or will be doing any long term web development, I would advise installing apache2, php, mysql, etc from MacPorts or Homebrew. There is a little bit of a learning curve, but it's easy when you get the hang of it and you will benefit over the long haul. Example port commands:
Search for applications to install
port search apache2
Install apache2
sudo port install apache2 (currently version 2.2.22)
Uninstall apache2
sudo port uninstall apache2
Upgrade..
sudo port upgrade apache2
Also, MacPorts installs everything into the /opt/ directory (I think Homebrew does as well), so you can always just delete the entire directory if you do not want them anymore. Again, if you do not mind digging in the trenches a bit and can be patient while your computer compiles these apps from source code (this can be lengthy), it will be worth your while.
Solution 2:
No easy way that I know of, but if the MAMP FAQ is correct, MAMP doesn't alter the default apache install in any way, so no guarantee it would help anyway.
If spurious apache processes is the problem, maybe look for any launchd jobs that MAMP has installed and not cleaned up (Lingon can help if you're not familiar with the command line)?
If all else fails of course, there's always the (annoying but effective) backup + clean OS X reinstall + migration assistant option, which might be a more effective use of a couple of hours of your life than fiddling about trying to fix it, if it's critical to get things working again...
EDIT: You might also double-check the complete list of files that MAMP claims to touch, just to make sure none of them have been left lying around on your machine, or have been altered in any way.