Apache won't start on Mac Yosemite (or another OS)
After finally getting around to updating Yosemite on my Mac Apache started being a headache. Initially it had commented out my Virtual Hosts includes line in httpd.conf, but when that was fixed it simply wouldn't start up at all. Every time I ran $ sudo apachectl start
I just kept seeing the following in the Console.app.
com.apple.xpc.launchd[1]: (org.apache.httpd) Service only ran for 0 seconds. Pushing respawn out by 10 seconds.
As this didn't help I had to run the following to get a more detailed reason on why Apache is failing on me.
$ sudo apachectl stop
$ sudo apachectl # without any parameters i.e. stop/start/restart
The second command will dump the config errors and warnings of the Apache httpd to the terminal and my problem was simple:
Invalid command 'RewriteEngine', perhaps misspelled or defined by a module not included in the server configuration
I simply uncommented the load libexec/apache2/mod_rewrite.so line in httpd.conf and I was good to go with
sudo apachectl start