Mac OS prohibits Apache httpd from starting automatically
Blog Category:
Mac OS is not like Linux has/etc/init.d/rc.local and service way can set program random start, but use plist file management.
plist files are distributed in:/system/library/launchdaemons/, where Apache's httpd program startup configuration file Org.apache.httpd.plist right here.
However, these configuration files can be loaded by the program Launchctl settings. That is, the plist file that appears in the results of the LAUNCHCTL List command is valid.
Launchctl requires root access.
Disable its random startup method:
sudo launchctl unload-w/system/library/launchdaemons/org.apache.httpd.plist
If there is no output, the uninstallation is successful. If you want to load, replace the unload with load.
The second run of unload will find an error: Launchctl:error unloading:org.apache.httpd, which indicates that the uninstallation was successful.
If you want to see the LAUNCHCTL usage, you can enter LAUNCHCTL in the shell terminal and enter the help carriage return. Quit quitting.
I have successfully operated on my Mac and httpd will not start after reboot. But the strange thing is that when I started the httpd myself with Apachectl, the next day to open the computer found httpd and automatically started. I wondered if the Apachectl script would load it, open/usr/sbin/apachectl, and find that the boot httpd was using the Launchctl load method.
In order to let the initiative of the start or not in my own hands, had to abandon the use of Apachectl start, using their own written httpd script to start, in fact, it is the implementation of Start,stop,restart three conditions to judge can, I use a little longer, so slightly more complex, See annex.
Once replaced, don't forget to run it again:
sudo launchctl unload-w/system/library/launchdaemons/org.apache.httpd.plist
- Apachectl.tar.gz (1.2 KB)
- Download number of times: 27
Mac OS disable Apache httpd auto-start (GO)