Mac OS disable Apache httpd auto-start (GO)

Source: Internet
Author: User
Tags root access

Mac OS prohibits Apache httpd from starting automatically Blog Category:
    • Computer use

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)

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.