Note: This assumes you have already configured and setup Apache on the Mac, if you have not done so already you should start there, otherwise you’re auto-loading Apache without much configuration.
Set Apache to Start Automatically on Boot in Mac OS X
From the Terminal, enter the following command:
sudo launchctl load -w /System/Library/LaunchDaemons/org.apache.httpd.plist
Hit return and enter the admin password as requested to complete the job.
Now when the Mac is booted or rebooted, Apache will start automatically, which is easily verified by going to any browser and entering “localhost” as the URL.
You’ll see the familiar “It Works!” message at localhost and those core files are located in:
/Library/WebServer/Documents/
Going further, you can also enable the user level Sites option for localhost/~User.
Stop Apache from Loading on Boot in Mac OS X
To stop Apache from starting itself automatically upon system start, you simply need to remove the agent from launchd as with any other daemon, like so:
sudo launchctl unload -w /System/Library/LaunchDaemons/org.apache.httpd.plist
Again you will need to enter the admin password to confirm the change.
Determine if Apache is Loaded or Unloaded in launchd
If you’re not sure whether you have set Apache to load automatically or not, you can query launchd for apache like so:
launchctl list|grep apache
Don’t see apache.httpd returned? Then the daemon is not loaded, and it will not automatically start. Apache can still be used and started manually, but it won’t start itself with a reboot or boot, pretty simple.
Source: osxdaily.com
0 Response to "How to Set Apache to Start Automatically on Boot in Mac OS X"
Post a Comment